mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-02 07:07: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
|
--init (-i): bool # git init
|
||||||
] {
|
] {
|
||||||
if $init {
|
if $init {
|
||||||
git init $repo
|
if ($repo | is-empty) {
|
||||||
cd $repo
|
git init --initial-branch main
|
||||||
|
} else {
|
||||||
|
git init $repo --initial-branch main
|
||||||
|
cd $repo
|
||||||
|
}
|
||||||
if $submodule {
|
if $submodule {
|
||||||
git submodule init
|
git submodule init
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,10 +92,7 @@ def time_segment [] {
|
||||||
def logtime [msg act] {
|
def logtime [msg act] {
|
||||||
let start = (date now)
|
let start = (date now)
|
||||||
let result = (do $act)
|
let result = (do $act)
|
||||||
let period = ((date now) - $start
|
let period = ($"((date now) - $start | into duration -c ns)" | str replace ' ' '')
|
||||||
| into duration -c ns
|
|
||||||
| into string
|
|
||||||
| str replace ' ' '')
|
|
||||||
|
|
||||||
echo $'($start | date format '%Y-%m-%d_%H:%M:%S%z')(char tab)($period)(char tab)($msg)(char newline)'
|
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
|
| save -a ~/.cache/nushell/power_time.log
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue