Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

nushell/modules/commands.nu

Raw
# Tiny interactive shell commands.
export def "&" [cmd: string, ...args] {
    job spawn --description $cmd { run-external $cmd ...$args }
}

# Luci: bugabinga.net ci
# luci exposes cli via ssh.
# my ssh config is already setup for easy and safe access.
# this wrapper simply delegates to luci via ssh.
export def luci [...args] { ssh ci ...$args }

# Remove a literal NUL entry.
export def rm-nul [target: path = "NUL"] {
    if not $env.WIN32 {
        error make {msg: "rm-nul is only available on Windows"}
    }

    let slash = "\u{5c}"
    # `\\?\` is parsed as a glob by Nu because of its `?`; `\\.\` reaches Win32 literally.
    let target = $slash + $slash + "." + $slash + ($target | path expand) | into string
    rm --permanent $target
}