Update `nvm_ensure_version_prefix` to support `iojs`-prefixed version strings.
parent
b7983842aa
commit
d28703f9e0
8
nvm.sh
8
nvm.sh
|
@ -211,7 +211,13 @@ nvm_normalize_version() {
|
||||||
}
|
}
|
||||||
|
|
||||||
nvm_ensure_version_prefix() {
|
nvm_ensure_version_prefix() {
|
||||||
echo "$1" | command sed -e 's/^\([0-9]\)/v\1/g'
|
local NVM_VERSION
|
||||||
|
NVM_VERSION="$(nvm_strip_iojs_prefix "$1" | command sed -e 's/^\([0-9]\)/v\1/g')"
|
||||||
|
if nvm_is_iojs_version "$1"; then
|
||||||
|
echo "$(nvm_add_iojs_prefix "$NVM_VERSION")"
|
||||||
|
else
|
||||||
|
echo "$NVM_VERSION"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
nvm_format_version() {
|
nvm_format_version() {
|
||||||
|
|
|
@ -7,3 +7,6 @@ die () { echo $@ ; exit 1; }
|
||||||
[ "_$(nvm_ensure_version_prefix 1)" = "_v1" ] || die '"nvm_ensure_version_prefix 1" did not return "v1"'
|
[ "_$(nvm_ensure_version_prefix 1)" = "_v1" ] || die '"nvm_ensure_version_prefix 1" did not return "v1"'
|
||||||
[ "_$(nvm_ensure_version_prefix v1)" = "_v1" ] || die '"nvm_ensure_version_prefix v1" did not return "v1"'
|
[ "_$(nvm_ensure_version_prefix v1)" = "_v1" ] || die '"nvm_ensure_version_prefix v1" did not return "v1"'
|
||||||
[ "_$(nvm_ensure_version_prefix foo)" = "_foo" ] || die '"nvm_ensure_version_prefix foo" did not return "foo"'
|
[ "_$(nvm_ensure_version_prefix foo)" = "_foo" ] || die '"nvm_ensure_version_prefix foo" did not return "foo"'
|
||||||
|
|
||||||
|
[ "_$(nvm_ensure_version_prefix iojs-1)" = "_iojs-v1" ] || die '"nvm_ensure_version_prefix iojs-1" did not return "iojs-v1"'
|
||||||
|
[ "_$(nvm_ensure_version_prefix iojs-v1)" = "_iojs-v1" ] || die '"nvm_ensure_version_prefix iojs-v1" did not return "iojs-v1"'
|
||||||
|
|
Loading…
Reference in New Issue