mirror of
https://github.com/Cian-H/dotfiles.git
synced 2026-01-06 09:01:57 +00:00
Changed . token to _dot
This change allows the dotfiles to work with chezmoi (e.g: on windows) and improves grepability with neovim/telescope
This commit is contained in:
24
dot_config/nushell/nu_scripts/modules/log/log.nu
Normal file
24
dot_config/nushell/nu_scripts/modules/log/log.nu
Normal file
@@ -0,0 +1,24 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user