Ensure `nvm_version node` and `nvm_version node-` report the latest stable node version.
parent
247bd310ef
commit
f1f11e3b7a
5
nvm.sh
5
nvm.sh
|
@ -199,6 +199,11 @@ nvm_version() {
|
||||||
return $?
|
return $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
case "_$PATTERN" in
|
||||||
|
"_$(nvm_node_prefix)" | "_$(nvm_node_prefix)-")
|
||||||
|
PATTERN="stable"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
VERSION="$(nvm_ls "$PATTERN" | tail -n1)"
|
VERSION="$(nvm_ls "$PATTERN" | tail -n1)"
|
||||||
if [ -z "$VERSION" ] || [ "_$VERSION" = "_N/A" ]; then
|
if [ -z "$VERSION" ] || [ "_$VERSION" = "_N/A" ]; then
|
||||||
echo "N/A"
|
echo "N/A"
|
||||||
|
|
|
@ -29,8 +29,9 @@ nvm_ls() {
|
||||||
echo "line 2"
|
echo "line 2"
|
||||||
echo "pattern: $1"
|
echo "pattern: $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
[ "_$(nvm_version foo)" = "_pattern: foo" ] || die '"nvm_version foo" did not pass the pattern to "nvm_ls", or return the last line'
|
[ "_$(nvm_version foo)" = "_pattern: foo" ] || die '"nvm_version foo" did not pass the pattern to "nvm_ls", or return the last line'
|
||||||
|
[ "_$(nvm_version node)" = "_pattern: stable" ] || die '"nvm_version node" did not pass "stable" to "nvm_ls"'
|
||||||
|
[ "_$(nvm_version node-)" = "_pattern: stable" ] || die '"nvm_version node-" did not pass "stable" to "nvm_ls"'
|
||||||
|
|
||||||
nvm_ls() { echo "N/A"; }
|
nvm_ls() { echo "N/A"; }
|
||||||
OUTPUT="$(nvm_version foo)"
|
OUTPUT="$(nvm_version foo)"
|
||||||
|
|
Loading…
Reference in New Issue