Browse Source

Create nvm_version_path

master
Jordan Harband 11 years ago
parent
commit
986abbf5db
  1. 10
      nvm.sh
  2. 9
      test/fast/Unit tests/nvm_version_path

10
nvm.sh

@ -95,6 +95,16 @@ nvm_rc_version() { @@ -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

9
test/fast/Unit tests/nvm_version_path

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