From f6f5a759e1a10aa48643176894f238d1bc584b62 Mon Sep 17 00:00:00 2001 From: jolheiser Date: Wed, 20 Mar 2024 12:57:56 -0500 Subject: [PATCH] feat: comma Signed-off-by: jolheiser --- apps/nogui/nushell/jolheiser.nu | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/nogui/nushell/jolheiser.nu b/apps/nogui/nushell/jolheiser.nu index d7eb6fa..c6a7d3d 100644 --- a/apps/nogui/nushell/jolheiser.nu +++ b/apps/nogui/nushell/jolheiser.nu @@ -69,6 +69,18 @@ def gomodsri [] { echo 'nixpkgs.lib.fileContents ./go.mod.sri' } +# Run a command if known, otherwise run it with nix +def , [ + 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 +} + ## Other ## $env.EDITOR = hx $env.config = ($env.config | upsert "shell_integration" ("WEZTERM_PANE" not-in $env and "SSH_CLIENT" not-in $env))