1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-01 06:37:46 +00:00

upgrade 0.83 (#563)

fix `<duration> | into string`
`gn` allows init git repo in current directory, and use `main` as
default branch

Co-authored-by: agent <agent@nuc>
This commit is contained in:
fj0r 2023-07-26 19:46:23 +08:00 committed by GitHub
parent e6adf4e0ae
commit c1b68089ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View file

@ -182,8 +182,12 @@ export def-env gn [
--init (-i): bool # git init
] {
if $init {
git init $repo
cd $repo
if ($repo | is-empty) {
git init --initial-branch main
} else {
git init $repo --initial-branch main
cd $repo
}
if $submodule {
git submodule init
}

View file

@ -92,10 +92,7 @@ def time_segment [] {
def logtime [msg act] {
let start = (date now)
let result = (do $act)
let period = ((date now) - $start
| into duration -c ns
| into string
| str replace ' ' '')
let period = ($"((date now) - $start | into duration -c ns)" | str replace ' ' '')
echo $'($start | date format '%Y-%m-%d_%H:%M:%S%z')(char tab)($period)(char tab)($msg)(char newline)'
| save -a ~/.cache/nushell/power_time.log