Add `nvm_strip_iojs_prefix`
parent
98e0655198
commit
c12104cecd
11
nvm.sh
11
nvm.sh
|
@ -358,6 +358,16 @@ nvm_is_iojs_version() {
|
||||||
[ "_$(echo "$1" | cut -c1-5)" = "_iojs-" ]
|
[ "_$(echo "$1" | cut -c1-5)" = "_iojs-" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nvm_strip_iojs_prefix() {
|
||||||
|
local NVM_IOJS_PREFIX
|
||||||
|
NVM_IOJS_PREFIX="$(nvm_iojs_prefix)"
|
||||||
|
if [ "_$1" = "_$NVM_IOJS_PREFIX" ]; then
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
echo "$1" | command sed "s/^$NVM_IOJS_PREFIX-//"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
nvm_ls() {
|
nvm_ls() {
|
||||||
local PATTERN
|
local PATTERN
|
||||||
PATTERN="$1"
|
PATTERN="$1"
|
||||||
|
@ -1202,6 +1212,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_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 \
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
die () { echo $@ ; exit 1; }
|
||||||
|
|
||||||
|
. ../../../nvm.sh
|
||||||
|
|
||||||
|
[ "_$(nvm_strip_iojs_prefix iojs)" = "_" ] || die '"nvm_strip_iojs_prefix iojs" did not return an empty string'
|
||||||
|
[ "_$(nvm_strip_iojs_prefix iojs-)" = "_" ] || die '"nvm_strip_iojs_prefix iojs-" did not return an empty string'
|
||||||
|
[ "_$(nvm_strip_iojs_prefix iojs-foo)" = "_foo" ] || die '"nvm_strip_iojs_prefix iojs-foo" did not return "foo"'
|
||||||
|
[ "_$(nvm_strip_iojs_prefix iojsfoo)" = "_iojsfoo" ] || die '"nvm_strip_iojs_prefix iojsfoo" did not return "iojsfoo"'
|
Loading…
Reference in New Issue