Automatically create LTS aliases every time we talk to nodejs.org/dist
parent
17c9bef4aa
commit
c83664960e
28
nvm.sh
28
nvm.sh
|
@ -912,11 +912,37 @@ nvm_ls_remote_index_tab() {
|
||||||
ZSH_HAS_SHWORDSPLIT_UNSET="$(setopt | nvm_grep shwordsplit > /dev/null && nvm_echo $? || nvm_echo $?)"
|
ZSH_HAS_SHWORDSPLIT_UNSET="$(setopt | nvm_grep shwordsplit > /dev/null && nvm_echo $? || nvm_echo $?)"
|
||||||
setopt shwordsplit
|
setopt shwordsplit
|
||||||
fi
|
fi
|
||||||
VERSIONS="$(nvm_download -L -s "$MIRROR/index.tab" -o - \
|
local VERSION_LIST
|
||||||
|
VERSION_LIST="$(nvm_download -L -s "$MIRROR/index.tab" -o - \
|
||||||
| command sed "
|
| command sed "
|
||||||
1d;
|
1d;
|
||||||
s/^/$PREFIX/;
|
s/^/$PREFIX/;
|
||||||
" \
|
" \
|
||||||
|
)"
|
||||||
|
local LTS_ALIAS
|
||||||
|
local LTS_VERSION
|
||||||
|
nvm_echo "$VERSION_LIST" \
|
||||||
|
| awk '{
|
||||||
|
if ($10 ~ /^\-?$/) { next }
|
||||||
|
if ($10 && !a[tolower($10)]++) {
|
||||||
|
if (alias) { print alias, version }
|
||||||
|
alias = "lts/" tolower($10)
|
||||||
|
version = $1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
END {
|
||||||
|
if (alias) {
|
||||||
|
print alias, version
|
||||||
|
print "lts/*", alias
|
||||||
|
}
|
||||||
|
}' \
|
||||||
|
| while read -r LTS_ALIAS_LINE; do
|
||||||
|
LTS_ALIAS="${LTS_ALIAS_LINE%% *}"
|
||||||
|
LTS_VERSION="${LTS_ALIAS_LINE#* }"
|
||||||
|
nvm_make_alias "$LTS_ALIAS" "$LTS_VERSION" >/dev/null 2>&1
|
||||||
|
done
|
||||||
|
|
||||||
|
VERSIONS="$(nvm_echo "$VERSION_LIST" \
|
||||||
| command awk -v pattern="${PATTERN-}" -v lts="${LTS-}" '{
|
| command awk -v pattern="${PATTERN-}" -v lts="${LTS-}" '{
|
||||||
if (!$1) { next }
|
if (!$1) { next }
|
||||||
if (pattern && tolower($1) !~ tolower(pattern)) { next }
|
if (pattern && tolower($1) !~ tolower(pattern)) { next }
|
||||||
|
|
Loading…
Reference in New Issue