From c1b68089ab2376c86fd55ba753da941d9ddbe5ab Mon Sep 17 00:00:00 2001 From: fj0r <82698591+fj0r@users.noreply.github.com> Date: Wed, 26 Jul 2023 19:46:23 +0800 Subject: [PATCH] upgrade 0.83 (#563) fix ` | into string` `gn` allows init git repo in current directory, and use `main` as default branch Co-authored-by: agent --- modules/git/git-v2.nu | 8 ++++++-- modules/prompt/powerline/power.nu | 5 +---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/git/git-v2.nu b/modules/git/git-v2.nu index e9f7099..75d21fa 100644 --- a/modules/git/git-v2.nu +++ b/modules/git/git-v2.nu @@ -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 } diff --git a/modules/prompt/powerline/power.nu b/modules/prompt/powerline/power.nu index 6e3a9af..3e53aa6 100644 --- a/modules/prompt/powerline/power.nu +++ b/modules/prompt/powerline/power.nu @@ -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