Skip to content

Commit

Permalink
Print version in nvm install/use error
Browse files Browse the repository at this point in the history
Close #176
  • Loading branch information
jorgebucaran committed Mar 16, 2022
1 parent d639918 commit bef6f2f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions functions/nvm.fish
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ function nvm --argument-names cmd v --description "Node version manager"
end
end

set --local their_version $v

switch "$cmd"
case -v --version
echo "nvm, version 2.2.6"
Expand All @@ -35,7 +37,7 @@ function nvm --argument-names cmd v --description "Node version manager"
string match --entire --regex -- (_nvm_version_match $v) <$nvm_data/.index | read v alias

if ! set --query v[1]
echo "nvm: Invalid version number or alias: \"$argv[2..-1]\"" >&2
echo "nvm: Invalid version number or alias: \"$their_version\"" >&2
return 1
end

Expand Down Expand Up @@ -114,7 +116,7 @@ function nvm --argument-names cmd v --description "Node version manager"
_nvm_list | string match --entire --regex -- (_nvm_version_match $v) | read v __

if ! set --query v[1]
echo "nvm: Can't use Node \"$argv[2..-1]\", version must be installed first" >&2
echo "nvm: Can't use Node \"$their_version\", version must be installed first" >&2
return 1
end

Expand All @@ -135,7 +137,7 @@ function nvm --argument-names cmd v --description "Node version manager"
_nvm_list | string match --entire --regex -- (_nvm_version_match $v) | read v __

if ! set -q v[1]
echo "nvm: Node version not installed or invalid: \"$argv[2..-1]\"" >&2
echo "nvm: Node version not installed or invalid: \"$their_version\"" >&2
return 1
end

Expand Down

0 comments on commit bef6f2f

Please sign in to comment.