Support `nvm ls-remote stable` and `nvm ls-remote unstable`
parent
c918e570b6
commit
4cdf356cdc
6
nvm.sh
6
nvm.sh
|
@ -317,7 +317,9 @@ nvm_ls_remote() {
|
|||
local VERSIONS
|
||||
local GREP_OPTIONS
|
||||
GREP_OPTIONS=''
|
||||
if [ -n "$PATTERN" ]; then
|
||||
if nvm_validate_implicit_alias "$PATTERN" 2> /dev/null ; then
|
||||
PATTERN="$(nvm_remote_version "$(nvm_print_implicit_alias remote "$PATTERN")")"
|
||||
elif [ -n "$PATTERN" ]; then
|
||||
PATTERN="$(nvm_ensure_version_prefix "$PATTERN")"
|
||||
else
|
||||
PATTERN=".*"
|
||||
|
@ -518,7 +520,7 @@ nvm() {
|
|||
nobinary=1
|
||||
fi
|
||||
|
||||
provided_version=$1
|
||||
provided_version="$1"
|
||||
|
||||
if [ -z "$provided_version" ]; then
|
||||
if [ $version_not_provided -ne 1 ]; then
|
||||
|
|
|
@ -464,5 +464,22 @@ v0.3.8"
|
|||
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_ls_remote 0.3 did not output 0.3.x versions; got $OUTPUT"
|
||||
|
||||
# Sanity checks
|
||||
OUTPUT="$(nvm_print_implicit_alias remote stable)"
|
||||
EXPECTED_OUTPUT="0.10"
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_print_implicit_alias remote stable did not output $EXPECTED_OUTPUT; got $OUTPUT"
|
||||
|
||||
OUTPUT="$(nvm_print_implicit_alias remote unstable)"
|
||||
EXPECTED_OUTPUT="0.11"
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_print_implicit_alias remote unstable did not output $EXPECTED_OUTPUT; got $OUTPUT"
|
||||
|
||||
OUTPUT="$(nvm_ls_remote stable)"
|
||||
EXPECTED_OUTPUT="v0.10.32"
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_ls_remote stable did not output $EXPECTED_OUTPUT; got $OUTPUT"
|
||||
|
||||
OUTPUT="$(nvm_ls_remote unstable)"
|
||||
EXPECTED_OUTPUT="v0.11.14"
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_ls_remote unstable did not output $EXPECTED_OUTPUT; got $OUTPUT"
|
||||
|
||||
cleanup
|
||||
|
||||
|
|
Loading…
Reference in New Issue