repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

nushell/modules/commands.nu

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

export def ci [...args] {
    ssh -p 2223 root@ci.bugabinga.net ...$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
}