Create nvm_version_path

master
Jordan Harband 2014-08-19 00:55:54 -07:00
parent 6baa9a0918
commit 986abbf5db
2 changed files with 19 additions and 0 deletions

10
nvm.sh
View File

@ -95,6 +95,16 @@ nvm_rc_version() {
fi
}
nvm_version_path() {
local VERSION
VERSION="$1"
if [ -z "$VERSION" ]; then
echo "$NVM_DIR"
elif [ ! -z "$VERSION" ]; then
echo "$NVM_DIR/$VERSION"
fi
}
# Expand a version using the version cache
nvm_version() {
local PATTERN

View File

@ -0,0 +1,9 @@
#!/bin/sh
die () { echo $@ ; exit 1; }
. ../../../nvm.sh
[ "$(nvm_version_path)" = "$NVM_DIR" ] &&
[ "$(nvm_version_path foo)" = "$NVM_DIR/foo" ]