Use nvm_version_dir in nvm_version_path

master
Jordan Harband 2014-08-19 01:56:34 -07:00
parent 9068dda110
commit a2da9abd6d
2 changed files with 5 additions and 4 deletions

5
nvm.sh
View File

@ -112,9 +112,10 @@ nvm_version_path() {
local VERSION
VERSION="$1"
if [ -z "$VERSION" ]; then
echo "$NVM_DIR"
echo "version is required" >&2
return 3
elif [ ! -z "$VERSION" ]; then
echo "$NVM_DIR/$VERSION"
echo "$(nvm_version_dir old)/$VERSION"
fi
}

View File

@ -4,6 +4,6 @@ die () { echo $@ ; exit 1; }
. ../../../nvm.sh
[ "$(nvm_version_path)" = "$NVM_DIR" ] &&
[ "$(nvm_version_path foo)" = "$NVM_DIR/foo" ]
[ "$(nvm_version_path foo)" = "$NVM_DIR/foo" ] || die '"nvm_version_path foo" did not return correct location'
[ "$(nvm_version_path 2>&1)" = "version is required" ] || die '"nvm_version_path" did not error out'