mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-08-17 11:03:44 +00:00
Compare commits
15 Commits
c9e3f0cd06
...
387809f06d
Author | SHA1 | Date | |
---|---|---|---|
![]() |
387809f06d | ||
![]() |
abda08ec33 | ||
![]() |
6c2bf69621 | ||
![]() |
22dc48fa21 | ||
![]() |
03ecd5c33d | ||
![]() |
1dce063900 | ||
![]() |
ceff60c572 | ||
![]() |
56142b471c | ||
![]() |
35c801b1c9 | ||
![]() |
159bde0ef2 | ||
![]() |
5bc34992a9 | ||
![]() |
f20963eee8 | ||
![]() |
a37da3aa48 | ||
![]() |
5303492b87 | ||
![]() |
5925f32a63 |
6
nvm.sh
6
nvm.sh
@ -1837,7 +1837,7 @@ nvm_print_versions() {
|
||||
fi
|
||||
|
||||
command awk \
|
||||
-v remote_versions="$(printf '%s' "${1-}" | tr '\n' '|')" -v min_ver="${NVM_MIN:-v0}" \
|
||||
-v remote_versions="$(printf '%s' "${1-}" | tr '\n' '|')" -v min="${NVM_MIN:-v0}" \
|
||||
-v installed_versions="$(nvm_ls | tr '\n' '|')" -v current="$NVM_CURRENT" \
|
||||
-v installed_color="$INSTALLED_COLOR" -v system_color="$SYSTEM_COLOR" \
|
||||
-v current_color="$CURRENT_COLOR" -v default_color="$DEFAULT_COLOR" \
|
||||
@ -1860,7 +1860,7 @@ BEGIN {
|
||||
split(remote_versions, lines, "|");
|
||||
split(installed_versions, installed, "|");
|
||||
rows = alen(lines);
|
||||
filter_on = (vcmp("v0.0.0", min_ver) != 0);
|
||||
filter_on = (vcmp("v0.0.0", min) != 0);
|
||||
current_major = -1;
|
||||
for (m = n = 1; n <= rows; n++) {
|
||||
split(lines[n], fields, "[[:blank:]]+");
|
||||
@ -1877,7 +1877,7 @@ BEGIN {
|
||||
if (filter_on != 0) {
|
||||
if (is_installed != 0) {
|
||||
current_major = v2m(version);
|
||||
} else if (vcmp(version, min_ver) >= 0) {
|
||||
} else if (vcmp(version, min) >= 0) {
|
||||
filter_on = 0;
|
||||
} else if (v2m(version) != current_major) {
|
||||
continue;
|
||||
|
@ -53,7 +53,7 @@ v21.1.0"
|
||||
|
||||
|
||||
# nvm_print_versions should print all versions from nvm_remote_versions
|
||||
OUTPUT="$(NVM_NO_COLORS=1 nvm_print_versions "$(nvm_remote_versions)" | sed -r 's/^[ \t]+//')"
|
||||
OUTPUT="$(NVM_NO_COLORS='--no-colors' nvm_print_versions "$(nvm_remote_versions)" | sed -r 's/^[ \t]+//')"
|
||||
EXPECTED_OUTPUT="v16.0.0
|
||||
v16.20.2 * (LTS: Gallium)
|
||||
v16.20.3 (Latest LTS: Gallium)
|
||||
@ -75,7 +75,7 @@ v21.1.0"
|
||||
|
||||
|
||||
# versions lower than 18 should be filtered out, but v16.20.2 should be kept since it's installed
|
||||
OUTPUT="$(NVM_NO_COLORS=1 NVM_MIN=v18 nvm_print_versions "$(nvm_remote_versions)" | sed -r 's/^[ \t]+//')"
|
||||
OUTPUT="$(NVM_NO_COLORS='--no-colors' NVM_MIN=v18 nvm_print_versions "$(nvm_remote_versions)" | sed -r 's/^[ \t]+//')"
|
||||
EXPECTED_OUTPUT="v16.20.2 * (LTS: Gallium)
|
||||
v16.20.3 (Latest LTS: Gallium)
|
||||
v18.0.0
|
||||
@ -94,7 +94,7 @@ v21.1.0"
|
||||
|
||||
|
||||
# versions lower than 19 should be filtered out
|
||||
OUTPUT="$(NVM_NO_COLORS=1 NVM_MIN=19 nvm_print_versions "$(nvm_remote_versions)" | sed -r 's/^[ \t]+//')"
|
||||
OUTPUT="$(NVM_NO_COLORS='--no-colors' NVM_MIN=19 nvm_print_versions "$(nvm_remote_versions)" | sed -r 's/^[ \t]+//')"
|
||||
EXPECTED_OUTPUT="v16.20.2 * (LTS: Gallium)
|
||||
v16.20.3 (Latest LTS: Gallium)
|
||||
-> v18.20.3 * (Latest LTS: Hydrogen)
|
||||
@ -110,7 +110,7 @@ v21.1.0"
|
||||
|
||||
|
||||
# versions lower than 20.1 should be filtered out, so v20.0.0 is out
|
||||
OUTPUT="$(NVM_NO_COLORS=1 NVM_MIN=v20.1 nvm_print_versions "$(nvm_remote_versions)" | sed -r 's/^[ \t]+//')"
|
||||
OUTPUT="$(NVM_NO_COLORS='--no-colors' NVM_MIN=v20.1 nvm_print_versions "$(nvm_remote_versions)" | sed -r 's/^[ \t]+//')"
|
||||
EXPECTED_OUTPUT="v16.20.2 * (LTS: Gallium)
|
||||
v16.20.3 (Latest LTS: Gallium)
|
||||
-> v18.20.3 * (Latest LTS: Hydrogen)
|
||||
@ -132,7 +132,7 @@ nvm_ls_current() {
|
||||
echo "v16.20.2"
|
||||
}
|
||||
|
||||
OUTPUT="$(NVM_NO_COLORS=1 NVM_MIN=20.1 nvm_print_versions "$(nvm_remote_versions)" | sed -r 's/^[ \t]+//')"
|
||||
OUTPUT="$(NVM_NO_COLORS='--no-colors' NVM_MIN=20.1 nvm_print_versions "$(nvm_remote_versions)" | sed -r 's/^[ \t]+//')"
|
||||
EXPECTED_OUTPUT="-> v16.20.2 * (LTS: Gallium)
|
||||
v16.20.3 (Latest LTS: Gallium)
|
||||
v20.8.1
|
||||
|
Loading…
x
Reference in New Issue
Block a user