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:
parent
e6adf4e0ae
commit
c1b68089ab
2 changed files with 7 additions and 6 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue