mirror of
https://github.com/Cian-H/dotfiles.git
synced 2025-12-26 04:41:58 +00:00
This change allows the dotfiles to work with chezmoi (e.g: on windows) and improves grepability with neovim/telescope
25 lines
651 B
Nu
25 lines
651 B
Nu
def logtime [msg act] {
|
|
let start = (date now)
|
|
let result = (do $act)
|
|
let period = ((date now) - $start
|
|
| into duration --unit ns
|
|
| into string
|
|
| str replace ' ' '')
|
|
|
|
echo $'($start | format date '%Y-%m-%d_%H:%M:%S%z')(char tab)($period)(char tab)($msg)(char newline)'
|
|
| save -a ~/.cache/nushell/time.log
|
|
|
|
return $result
|
|
}
|
|
|
|
export def timelog [] {
|
|
open ~/.cache/nushell/time.log
|
|
| from tsv -n
|
|
| rename start duration message
|
|
| each {|x|
|
|
$x
|
|
| update start ($x.start | into datetime -f '%Y-%m-%d_%H:%M:%S%z')
|
|
| update duration ($x.duration | into duration)
|
|
}
|
|
}
|