Skip to content

Commit

Permalink
Handle invalid --silent usage
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgebucaran committed May 31, 2022
1 parent 674689e commit 2d4dd61
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions functions/nvm.fish
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ function nvm --description "Node version manager"
set --local cmd $argv[1]
set --local ver $argv[2]

if test -z "$ver" && contains -- "$cmd" install use
if set --query silent && ! set --query cmd[1]
echo "nvm: Version number not specified (see nvm -h for usage)" >&2
return 1
end

if ! set --query ver[1] && contains -- "$cmd" install use
for file in .nvmrc .node-version
set file (_nvm_find_up $PWD $file) && read ver <$file && break
end
Expand Down Expand Up @@ -172,7 +177,7 @@ function nvm --description "Node version manager"
}
' - $nvm_data/.index | _nvm_list_format (_nvm_current) $argv[2]
case \*
echo "nvm: Unknown command or option: \"$cmd\" (see nvm -h)" >&2
echo "nvm: Unknown command or option: \"$cmd\" (see nvm -h for usage)" >&2
return 1
end
end
Expand Down

0 comments on commit 2d4dd61

Please sign in to comment.