Home

scripts @7bf1fa9e2883dcc1201b9c506a0a5eb338df37ff - refs - log -
-
https://git.jolheiser.com/scripts.git
A collection of Nushell scripts
scripts / nu / ,.nu
- raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Run a command if known, otherwise run it with nix
export def main [
    cmd: string     # The command to run
    ...args: string # Command arguments; all flags MUST be quoted
  ] {
  if (not (which $cmd | is-empty)) {
    ^$cmd ...$args
    return
  }
  ^nix run $"nixpkgs#($cmd)" -- ...$args
}