diff --git a/nvm.sh b/nvm.sh index 122b7286ec4..f20b08a2ea0 100644 --- a/nvm.sh +++ b/nvm.sh @@ -78,7 +78,7 @@ nvm_download() { ARGS=$(nvm_echo "$@" | command sed -e 's/--progress-bar /--progress=bar /' \ -e 's/-L //' \ -e 's/-I /--server-response /' \ - -e 's/-s /-q /' \ + -e 's/-sS /-nv /' \ -e 's/-o /-O /' \ -e 's/-C - /-c /') # shellcheck disable=SC2086 @@ -1569,10 +1569,16 @@ nvm_install_binary() { local TMPDIR local VERSION_PATH + local PROGRESS_BAR local NODE_OR_IOJS if [ "${FLAVOR}" = 'node' ]; then NODE_OR_IOJS="${FLAVOR}" fi + if [ -n "${NVM_NO_PROGRESS}" ]; then + PROGRESS_BAR="-sS" + else + PROGRESS_BAR="--progress-bar" + fi nvm_echo "Downloading and installing ${NODE_OR_IOJS-} ${VERSION}..." TARBALL="$(nvm_download_artifact "${FLAVOR}" binary "${TYPE-}" "${VERSION}" | command tail -1)" if [ -f "${TARBALL}" ]; then @@ -1731,7 +1737,7 @@ nvm_download_artifact() { command rm -rf "${TARBALL}" fi nvm_err "Downloading ${TARBALL_URL}..." - nvm_download -L -C - --progress-bar "${TARBALL_URL}" -o "${TARBALL}" || ( + nvm_download -L -C - "${PROGRESS_BAR}" "${TARBALL_URL}" -o "${TARBALL}" || ( command rm -rf "${TARBALL}" "${tmpdir}" nvm_err "Binary download from ${TARBALL_URL} failed, trying source." return 4 @@ -2262,6 +2268,7 @@ nvm() { fi local nobinary + local noprogress nobinary=0 local LTS while [ $# -ne 0 ] @@ -2276,6 +2283,10 @@ nvm() { nvm_get_make_jobs "$1" shift # consume job count ;; + --no-progress) + noprogress=1 + shift + ;; --lts) LTS='*' shift @@ -2436,7 +2447,7 @@ nvm() { # skip binary install if "nobinary" option specified. if [ $nobinary -ne 1 ] && nvm_binary_available "$VERSION"; then - nvm_install_binary "${FLAVOR}" std "${VERSION}" + NVM_NO_PROGRESS="${NVM_NO_PROGRESS:-${noprogress}}" nvm_install_binary "${FLAVOR}" std "${VERSION}" EXIT_CODE=$? fi if [ "$EXIT_CODE" -ne 0 ]; then @@ -2444,7 +2455,7 @@ nvm() { nvm_get_make_jobs fi - nvm_install_source "${FLAVOR}" std "${VERSION}" "${NVM_MAKE_JOBS}" "${ADDITIONAL_PARAMETERS}" + NVM_NO_PROGRESS="${NVM_NO_PROGRESS:-${noprogress}}" nvm_install_source "${FLAVOR}" std "${VERSION}" "${NVM_MAKE_JOBS}" "${ADDITIONAL_PARAMETERS}" EXIT_CODE=$? fi