Add support for `nvm ls stable` and `nvm ls unstable`
parent
5dc7af6285
commit
c918e570b6
5
nvm.sh
5
nvm.sh
|
@ -274,6 +274,11 @@ nvm_ls() {
|
|||
fi
|
||||
else
|
||||
if [ "_$PATTERN" != "_system" ]; then
|
||||
if nvm_validate_implicit_alias "$PATTERN" 2> /dev/null ; then
|
||||
nvm_ls "$(nvm_print_implicit_alias local "$PATTERN" 2> /dev/null)"
|
||||
return $?
|
||||
fi
|
||||
|
||||
local NUM_VERSION_GROUPS
|
||||
NUM_VERSION_GROUPS="$(nvm_num_version_groups "$PATTERN")"
|
||||
if [ "_$NUM_VERSION_GROUPS" = "_2" ] || [ "_$NUM_VERSION_GROUPS" = "_1" ]; then
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
EXPECTED_STABLE="$(nvm_print_implicit_alias local stable)"
|
||||
STABLE_VERSION="$(nvm_version "$EXPECTED_STABLE")"
|
||||
|
||||
EXPECTED_UNSTABLE="$(nvm_print_implicit_alias local unstable)"
|
||||
UNSTABLE_VERSION="$(nvm_version "$EXPECTED_UNSTABLE")"
|
||||
|
||||
nvm ls stable | \grep "$STABLE_VERSION" >/dev/null \
|
||||
|| die "expected 'nvm ls stable' to give $STABLE_VERSION, got $(nvm ls stable)"
|
||||
|
||||
nvm ls unstable | \grep "$UNSTABLE_VERSION" >/dev/null \
|
||||
|| die "expected 'nvm ls unstable' to give $UNSTABLE_VERSION, got $(nvm ls unstable)"
|
||||
|
||||
mkdir ../../../v0.1.2
|
||||
nvm alias stable 0.1
|
||||
|
||||
nvm ls stable | \grep v0.1.2 >/dev/null \
|
||||
&& nvm ls stable | \grep -v "$STABLE_VERSION" >/dev/null \
|
||||
|| die "'nvm ls stable' did not contain an explicit 'stable' alias"
|
||||
|
|
@ -11,4 +11,6 @@ rmdir ../../../v0.3.3 >/dev/null 2>&1
|
|||
rmdir ../../../v0.3.9 >/dev/null 2>&1
|
||||
rmdir ../../../versions >/dev/null 2>&1
|
||||
unalias nvm_has_system_node >/dev/null 2>&1
|
||||
rm -f ../../../alias/stable >/dev/null 2>&1
|
||||
rm -f ../../../alias/unstable >/dev/null 2>&1
|
||||
|
||||
|
|
Loading…
Reference in New Issue