[Fix] `ls-remote`/`install`: properly handle `lts/x` patterns
parent
0b4cd8df6c
commit
aed1d732d7
10
nvm.sh
10
nvm.sh
|
@ -3812,8 +3812,14 @@ nvm() {
|
||||||
PATTERN="${1-}"
|
PATTERN="${1-}"
|
||||||
if [ -z "${NVM_LTS-}" ]; then
|
if [ -z "${NVM_LTS-}" ]; then
|
||||||
case "${PATTERN}" in
|
case "${PATTERN}" in
|
||||||
'lts/*') NVM_LTS='*' ;;
|
'lts/*')
|
||||||
lts/*) NVM_LTS="${PATTERN##lts/}" ;;
|
NVM_LTS='*'
|
||||||
|
PATTERN=''
|
||||||
|
;;
|
||||||
|
lts/*)
|
||||||
|
NVM_LTS="${PATTERN##lts/}"
|
||||||
|
PATTERN=''
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -ex
|
set -e
|
||||||
|
|
||||||
die () { echo "$@" ; cleanup ; exit 1; }
|
die () { echo "$@" ; cleanup ; exit 1; }
|
||||||
|
|
||||||
|
@ -32,9 +32,18 @@ nvm_ls_remote_iojs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPECTED_OUTPUT_PATH="$PWD/mocks/nvm ls-remote.txt"
|
EXPECTED_OUTPUT_PATH="$PWD/mocks/nvm ls-remote.txt"
|
||||||
|
|
||||||
OUTPUT="$(nvm ls-remote | sed 's/[ \t]*$//')"
|
OUTPUT="$(nvm ls-remote | sed 's/[ \t]*$//')"
|
||||||
EXPECTED_OUTPUT="$(cat "$EXPECTED_OUTPUT_PATH" | sed 's/[ \t]*$//' )"
|
EXPECTED_OUTPUT="$(cat "$EXPECTED_OUTPUT_PATH" | sed 's/[ \t]*$//' )"
|
||||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "bare nvm ls-remote did not output expected sorted versions; got $(echo ">$OUTPUT<") expected $(echo ">$EXPECTED_OUTPUT<")"
|
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "bare nvm ls-remote did not output expected sorted versions; got $(echo ">$OUTPUT<") expected $(echo ">$EXPECTED_OUTPUT<")"
|
||||||
|
|
||||||
|
EXPECTED_OUTPUT_PATH="$PWD/mocks/nvm ls-remote lts.txt"
|
||||||
|
OUTPUT="$(nvm ls-remote --lts="*" | sed 's/[ \t]*$//')"
|
||||||
|
EXPECTED_OUTPUT="$(cat "$EXPECTED_OUTPUT_PATH" | sed 's/[ \t]*$//' )"
|
||||||
|
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm ls-remote --lts=* did not output expected sorted versions; got $(echo ">$OUTPUT<") expected $(echo ">$EXPECTED_OUTPUT<")"
|
||||||
|
|
||||||
|
EXPECTED_OUTPUT_PATH="$PWD/mocks/nvm ls-remote lts.txt"
|
||||||
|
OUTPUT="$(nvm ls-remote "lts/*" | sed 's/[ \t]*$//')"
|
||||||
|
EXPECTED_OUTPUT="$(cat "$EXPECTED_OUTPUT_PATH" | sed 's/[ \t]*$//' )"
|
||||||
|
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm ls-remote lts/* did not output expected sorted versions; got $(echo ">$OUTPUT<") expected $(echo ">$EXPECTED_OUTPUT<")"
|
||||||
|
|
||||||
cleanup
|
cleanup
|
||||||
|
|
Loading…
Reference in New Issue