Skip to content

Commit 96d4d30

Browse files
committed
rename NVM_MIN_VER to NVM_MIN
since nvm is all about versions, so no need for the explicit suffix.
1 parent b265527 commit 96d4d30

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

nvm.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1820,7 +1820,7 @@ nvm_print_versions() {
18201820
fi
18211821

18221822
command awk \
1823-
-v remote_versions="$(printf '%s' "${1-}" | tr '\n' '|')" -v min_ver="${NVM_MIN_VER:-v0}" \
1823+
-v remote_versions="$(printf '%s' "${1-}" | tr '\n' '|')" -v min_ver="${NVM_MIN:-v0}" \
18241824
-v installed_versions="$(nvm_ls | tr '\n' '|')" -v current="$NVM_CURRENT" \
18251825
-v installed_color="$INSTALLED_COLOR" -v system_color="$SYSTEM_COLOR" \
18261826
-v current_color="$CURRENT_COLOR" -v default_color="$DEFAULT_COLOR" \

test/fast/Unit tests/nvm_print_versions

+13-13
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ die () { echo "$@" ; cleanup ; exit 1; }
66

77
cleanup() {
88
unset -f nvm_remote_versions nvm_ls nvm_ls_current nvm_remote_versions
9-
if [ -n "$TEMP_NVM_MIN_VER" ]; then
10-
export NVM_MIN_VER="$TEMP_NVM_MIN_VER"
9+
if [ -n "$TEMP_NVM_MIN" ]; then
10+
export NVM_MIN="$TEMP_NVM_MIN"
1111
fi
1212
}
1313

1414
\. ../../../nvm.sh
1515

1616

17-
if [ -n "$NVM_MIN_VER" ]; then
18-
TEMP_NVM_MIN_VER="$NVM_MIN_VER"
19-
unset NVM_MIN_VER
17+
if [ -n "$NVM_MIN" ]; then
18+
TEMP_NVM_MIN="$NVM_MIN"
19+
unset NVM_MIN
2020
fi
2121

2222
# mock currently installed versions
@@ -72,7 +72,7 @@ v21.1.0"
7272

7373

7474
# versions lower than 18 should be filtered out, but v16.20.2 should be kept since it's installed
75-
OUTPUT="$(NVM_NO_COLORS=1 NVM_MIN_VER=18 nvm_print_versions "$(nvm_remote_versions)" | sed -r 's/^[ \t]+//')"
75+
OUTPUT="$(NVM_NO_COLORS=1 NVM_MIN=18 nvm_print_versions "$(nvm_remote_versions)" | sed -r 's/^[ \t]+//')"
7676
EXPECTED_OUTPUT="v16.20.2 * (Latest LTS: Gallium)
7777
v18.0.0
7878
v18.1.0
@@ -86,11 +86,11 @@ v20.9.0 (Latest LTS: Iron)
8686
v21.0.0
8787
v21.1.0"
8888

89-
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "NVM_MIN_VER=18 nvm_print_versions did not output all expected versions; got $OUTPUT"
89+
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "NVM_MIN=18 nvm_print_versions did not output all expected versions; got $OUTPUT"
9090

9191

9292
# versions lower than 19 should be filtered out
93-
OUTPUT="$(NVM_NO_COLORS=1 NVM_MIN_VER=19 nvm_print_versions "$(nvm_remote_versions)" | sed -r 's/^[ \t]+//')"
93+
OUTPUT="$(NVM_NO_COLORS=1 NVM_MIN=19 nvm_print_versions "$(nvm_remote_versions)" | sed -r 's/^[ \t]+//')"
9494
EXPECTED_OUTPUT="v16.20.2 * (Latest LTS: Gallium)
9595
-> v18.20.3 * (Latest LTS: Hydrogen)
9696
v19.0.0
@@ -101,19 +101,19 @@ v20.9.0 (Latest LTS: Iron)
101101
v21.0.0
102102
v21.1.0"
103103

104-
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "NVM_MIN_VER=19 nvm_print_versions did not output all expected versions; got $OUTPUT"
104+
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "NVM_MIN=19 nvm_print_versions did not output all expected versions; got $OUTPUT"
105105

106106

107107
# versions lower than 20.1 should be filtered out, so v20.0.0 is out
108-
OUTPUT="$(NVM_NO_COLORS=1 NVM_MIN_VER=20.1 nvm_print_versions "$(nvm_remote_versions)" | sed -r 's/^[ \t]+//')"
108+
OUTPUT="$(NVM_NO_COLORS=1 NVM_MIN=20.1 nvm_print_versions "$(nvm_remote_versions)" | sed -r 's/^[ \t]+//')"
109109
EXPECTED_OUTPUT="v16.20.2 * (Latest LTS: Gallium)
110110
-> v18.20.3 * (Latest LTS: Hydrogen)
111111
v20.8.1
112112
v20.9.0 (Latest LTS: Iron)
113113
v21.0.0
114114
v21.1.0"
115115

116-
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "NVM_MIN_VER=20.1 nvm_print_versions did not output all expected versions; got $OUTPUT"
116+
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "NVM_MIN=20.1 nvm_print_versions did not output all expected versions; got $OUTPUT"
117117

118118

119119
# assume v18.20.3 is NOT installed, so now it should be filtered out
@@ -126,14 +126,14 @@ nvm_ls_current() {
126126
echo "v16.20.2"
127127
}
128128

129-
OUTPUT="$(NVM_NO_COLORS=1 NVM_MIN_VER=20.1 nvm_print_versions "$(nvm_remote_versions)" | sed -r 's/^[ \t]+//')"
129+
OUTPUT="$(NVM_NO_COLORS=1 NVM_MIN=20.1 nvm_print_versions "$(nvm_remote_versions)" | sed -r 's/^[ \t]+//')"
130130
EXPECTED_OUTPUT="-> v16.20.2 * (Latest LTS: Gallium)
131131
v20.8.1
132132
v20.9.0 (Latest LTS: Iron)
133133
v21.0.0
134134
v21.1.0"
135135

136-
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "NVM_MIN_VER=20.1 nvm_print_versions did not output all expected versions; got $OUTPUT"
136+
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "NVM_MIN=20.1 nvm_print_versions did not output all expected versions; got $OUTPUT"
137137

138138

139139
cleanup

0 commit comments

Comments
 (0)