Skip to content
Snippets Groups Projects

and `inbreeding watch` command

Merged STEVAN Antoine requested to merge inbreeding-watch into main
1 file
+ 11
4
Compare changes
  • Side-by-side
  • Inline
+ 11
4
@@ -3,10 +3,17 @@ use path.nu [ "remove-cache-prefix" ]
export def main [] {
watch $CACHE { |op, path, new_path|
if $op == "Create" {
let now = date now | format date "%Y-%m-%d %H:%M:%S"
let p = $path | remove-cache-prefix | parse "{seed}/{exp}/{id}" | into record
$"($p.seed | str substring 0..7) ($p.exp) ($p.id | str substring 0..7) at ($now)"
if $op != "Create" {
return
}
let now = date now | format date "%Y-%m-%d %H:%M:%S"
let p = $path | remove-cache-prefix | parse "{seed}/{exp}/{id}" | into record
if $p == {} {
return $"($path | remove-cache-prefix) created"
}
$"($p.seed | str substring 0..7) ($p.exp) ($p.id | str substring 0..7) at ($now)"
}
}
Loading