Compare commits

..

1 Commits

Author SHA1 Message Date
Atsushi Yamamoto
8591aab755
Merge 27dea683a5 into 74eb396099 2025-02-05 18:12:30 +08:00

47
nvm.sh
View File

@ -136,17 +136,15 @@ nvm_download() {
eval "curl -q --fail ${CURL_COMPRESSED_FLAG:-} ${CURL_HEADER_FLAG:-} ${NVM_DOWNLOAD_ARGS}" eval "curl -q --fail ${CURL_COMPRESSED_FLAG:-} ${CURL_HEADER_FLAG:-} ${NVM_DOWNLOAD_ARGS}"
elif nvm_has "wget"; then elif nvm_has "wget"; then
# Emulate curl with wget # Emulate curl with wget
ARGS=$(nvm_echo "$@" | command sed " ARGS=$(nvm_echo "$@" | command sed -e 's/--progress-bar /--progress=bar /' \
s/--progress-bar /--progress=bar / -e 's/--compressed //' \
s/--compressed // -e 's/--fail //' \
s/--fail // -e 's/-L //' \
s/-L // -e 's/-I /--server-response /' \
s/-I /--server-response / -e 's/-s /-q /' \
s/-s /-q / -e 's/-sS /-nv /' \
s/-sS /-nv / -e 's/-o /-O /' \
s/-o /-O / -e 's/-C - /-c /')
s/-C - /-c /
")
if [ -n "${NVM_AUTH_HEADER:-}" ]; then if [ -n "${NVM_AUTH_HEADER:-}" ]; then
ARGS="${ARGS} --header \"${NVM_AUTH_HEADER}\"" ARGS="${ARGS} --header \"${NVM_AUTH_HEADER}\""
@ -1420,11 +1418,11 @@ nvm_add_iojs_prefix() {
nvm_strip_iojs_prefix() { nvm_strip_iojs_prefix() {
local NVM_IOJS_PREFIX local NVM_IOJS_PREFIX
NVM_IOJS_PREFIX="$(nvm_iojs_prefix)" NVM_IOJS_PREFIX="$(nvm_iojs_prefix)"
if [ "${1-}" = "${NVM_IOJS_PREFIX}" ]; then
case "${1-}" in nvm_echo
"${NVM_IOJS_PREFIX}") nvm_echo ;; else
*) nvm_echo "${1#"${NVM_IOJS_PREFIX}"-}" ;; nvm_echo "${1#"${NVM_IOJS_PREFIX}"-}"
esac fi
} }
nvm_ls() { nvm_ls() {
@ -1556,15 +1554,12 @@ nvm_ls() {
fi fi
if [ "${NVM_ADD_SYSTEM-}" = true ]; then if [ "${NVM_ADD_SYSTEM-}" = true ]; then
case "${PATTERN}" in if [ -z "${PATTERN}" ] || [ "${PATTERN}" = 'v' ]; then
'' | v) VERSIONS="${VERSIONS}
VERSIONS="${VERSIONS}
system" system"
;; elif [ "${PATTERN}" = 'system' ]; then
system) VERSIONS="system"
VERSIONS="system" fi
;;
esac
fi fi
if [ -z "${VERSIONS}" ]; then if [ -z "${VERSIONS}" ]; then
@ -1698,7 +1693,7 @@ EOF
LTS="${LTS#lts/}" LTS="${LTS#lts/}"
fi fi
VERSIONS="$( { command awk -v lts="${LTS-}" '{ VERSIONS="$({ command awk -v lts="${LTS-}" '{
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 }
@ -2742,7 +2737,7 @@ nvm_npm_global_modules() {
local NPMLIST local NPMLIST
local VERSION local VERSION
VERSION="$1" VERSION="$1"
NPMLIST=$(nvm use "${VERSION}" >/dev/null && npm list -g --depth=0 2>/dev/null | command sed -e '1d' -e '/UNMET PEER DEPENDENCY/d') NPMLIST=$(nvm use "${VERSION}" >/dev/null && npm list -g --depth=0 2>/dev/null | command sed 1,1d | nvm_grep -v 'UNMET PEER DEPENDENCY')
local INSTALLS local INSTALLS
INSTALLS=$(nvm_echo "${NPMLIST}" | command sed -e '/ -> / d' -e '/\(empty\)/ d' -e 's/^.* \(.*@[^ ]*\).*/\1/' -e '/^npm@[^ ]*.*$/ d' | command xargs) INSTALLS=$(nvm_echo "${NPMLIST}" | command sed -e '/ -> / d' -e '/\(empty\)/ d' -e 's/^.* \(.*@[^ ]*\).*/\1/' -e '/^npm@[^ ]*.*$/ d' | command xargs)