[Fix] nvm_ls_remote_index_tab: only compare the pattern to the version, not the LTS name

Fixes 3474
This commit is contained in:
Jordan Harband 2024-11-21 12:53:31 -10:00
parent f7363acbb9
commit 4f91e99415
No known key found for this signature in database
GPG Key ID: 9F6A681E35EF8B56

4
nvm.sh
View File

@ -1667,10 +1667,11 @@ EOF
LTS="${LTS#lts/}" LTS="${LTS#lts/}"
fi fi
VERSIONS="$({ command awk -v lts="${LTS-}" '{ VERSIONS="$({ command awk -v lts="${LTS-}" -v pattern="${PATTERN:-.*}" '{
if (!$1) { next } if (!$1) { next }
if (lts && $10 ~ /^\-?$/) { next } if (lts && $10 ~ /^\-?$/) { next }
if (lts && lts != "*" && tolower($10) !~ tolower(lts)) { next } if (lts && lts != "*" && tolower($10) !~ tolower(lts)) { next }
if ($1 !~ pattern) { next }
if ($10 !~ /^\-?$/) { if ($10 !~ /^\-?$/) {
if ($10 && $10 != prev) { if ($10 && $10 != prev) {
print $1, $10, "*" print $1, $10, "*"
@ -1682,7 +1683,6 @@ EOF
} }
prev=$10; prev=$10;
}' \ }' \
| nvm_grep -w "${PATTERN:-.*}" \
| $SORT_COMMAND; } << EOF | $SORT_COMMAND; } << EOF
$VERSION_LIST $VERSION_LIST
EOF EOF