Add `nvm_add_iojs_prefix`

master
Jordan Harband 2015-01-13 00:57:32 -08:00
parent c12104cecd
commit b7983842aa
2 changed files with 14 additions and 1 deletions

6
nvm.sh
View File

@ -358,6 +358,10 @@ nvm_is_iojs_version() {
[ "_$(echo "$1" | cut -c1-5)" = "_iojs-" ] [ "_$(echo "$1" | cut -c1-5)" = "_iojs-" ]
} }
nvm_add_iojs_prefix() {
command echo "$(nvm_iojs_prefix)-$(nvm_ensure_version_prefix "$(nvm_strip_iojs_prefix "$1")")"
}
nvm_strip_iojs_prefix() { nvm_strip_iojs_prefix() {
local NVM_IOJS_PREFIX local NVM_IOJS_PREFIX
NVM_IOJS_PREFIX="$(nvm_iojs_prefix)" NVM_IOJS_PREFIX="$(nvm_iojs_prefix)"
@ -1212,7 +1216,7 @@ nvm() {
"unload" ) "unload" )
unset -f nvm nvm_print_versions nvm_checksum \ unset -f nvm nvm_print_versions nvm_checksum \
nvm_iojs_prefix nvm_node_prefix \ nvm_iojs_prefix nvm_node_prefix \
nvm_strip_iojs_prefix \ nvm_add_iojs_prefix nvm_strip_iojs_prefix \
nvm_is_iojs_version \ nvm_is_iojs_version \
nvm_ls_remote nvm_ls nvm_remote_version \ nvm_ls_remote nvm_ls nvm_remote_version \
nvm_version nvm_rc_version \ nvm_version nvm_rc_version \

View File

@ -0,0 +1,9 @@
#!/bin/sh
die () { echo $@ ; exit 1; }
. ../../../nvm.sh
[ "_$(nvm_add_iojs_prefix 1)" = "_iojs-v1" ] || die '"nvm_add_iojs_prefix 1" did not return "iojs-v1"'
[ "_$(nvm_add_iojs_prefix iojs-1)" = "_iojs-v1" ] || die '"nvm_add_iojs_prefix iojs-1" did not return "iojs-v1"'
[ "_$(nvm_add_iojs_prefix iojs-1.2.3)" = "_iojs-v1.2.3" ] || die '"nvm_add_iojs_prefix iojs-1.2.3" did not return "iojs-v1.2.3"'