From 1514fb44c5f46115cebf6aa6c2c41329b44f3289 Mon Sep 17 00:00:00 2001 From: Sander Declerck Date: Wed, 24 Sep 2025 14:51:32 +0200 Subject: [PATCH] init-fish: split up if to prevent expanded args to break the condition --- .../startup-scripts/init-fish.fish | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/safe-chain/src/shell-integration/startup-scripts/init-fish.fish b/packages/safe-chain/src/shell-integration/startup-scripts/init-fish.fish index 0190883..87f6a79 100644 --- a/packages/safe-chain/src/shell-integration/startup-scripts/init-fish.fish +++ b/packages/safe-chain/src/shell-integration/startup-scripts/init-fish.fish @@ -47,11 +47,15 @@ function pnpx end function npm - if test (count $argv) -eq 1 -a \( "$argv[1]" = "-v" -o "$argv[1]" = "--version" \) - # If args is just -v or --version and nothing else, just run the npm version command - # This is because nvm uses this to check the version of npm - command npm $argv - return + # If args is just -v or --version and nothing else, just run the `npm -v` command + # This is because nvm uses this to check the version of npm + set argc (count $argv) + if test $argc -eq 1 + switch $argv[1] + case "-v" "--version" + command npm $argv + return + end end wrapSafeChainCommand "npm" "aikido-npm" $argv