mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-10 14:21:50 +00:00
Create nvm_version_path
This commit is contained in:
parent
6baa9a0918
commit
986abbf5db
10
nvm.sh
10
nvm.sh
@ -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
Executable file
9
test/fast/Unit tests/nvm_version_path
Executable 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" ]
|
||||
|
Loading…
Reference in New Issue
Block a user