[Fix] `nvm use`: improve help output with bare `nvm use` and no `.nvmrc`

Closes #1914.
Jordan Harband 2019-10-08 14:40:17 -07:00
parent 011810e721
commit 94a72ae217
No known key found for this signature in database
GPG Key ID: 9F6A681E35EF8B56
1 changed files with 4 additions and 0 deletions

4
nvm.sh
View File

@ -2909,6 +2909,10 @@ nvm() {
VERSION="$(nvm_version "${PROVIDED_VERSION}")"
fi
unset NVM_RC_VERSION
if [ -z "${VERSION}" ]; then
nvm_err 'Please see `nvm --help` or https://github.com/nvm-sh/nvm#nvmrc for more information.'
return 127
fi
else
VERSION="$(nvm_match_version "${PROVIDED_VERSION}")"
fi