[Refactor] `nvm run`/`nvm exec`: use `NVM_SILENT` consistently internally
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Jordan Harband · committed by Jordan Harband · parent 1c00753 · Browse files · 1 file·+13 added−20 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+13 added−20 removed
- other:+13 added−20 removed
Provenance
- Commit
9dc6f3e- Tree
acd0085- Author
Jordan Harband <ljharb@gmail.com>- Committer
Jordan Harband <ljharb@gmail.com>- Parent
1c00753
1 file changed+13 added−20 removed
modified:nvm.sh+13 added-20 removed
3153 unmodified lines3154 has_checked_nvmrc=03155 # run given version of node3156 3157 local NVM_SILENT3158+ local NVM_SILENT_ARG3159 local NVM_LTS3160 while [ $# -gt 0 ]; do3161 case "$1" in3161- --silent) NVM_SILENT='--silent' ; shift ;;3162+ --silent)3163+ NVM_SILENT=13164+ NVM_SILENT_ARG='--silent'3165+ shift3166+ ;;3167 --lts) NVM_LTS='*' ; shift ;;3168 --lts=*) NVM_LTS="${1##--lts=}" ; shift ;;3169 *)3170 if [ -n "$1" ]; then5 unmodified lines3176 esac3177 done3178 3179 if [ $# -lt 1 ] && [ -z "${NVM_LTS-}" ]; then3175- if [ -n "${NVM_SILENT-}" ]; then3176- nvm_rc_version >/dev/null 2>&1 && has_checked_nvmrc=13177- else3178- nvm_rc_version && has_checked_nvmrc=13180+ NVM_SILENT="${NVM_SILENT:-0}" nvm_rc_version && has_checked_nvmrc=13179- fi3181 if [ -n "${NVM_RC_VERSION-}" ]; then3182 VERSION="$(nvm_version "${NVM_RC_VERSION-}")" ||:3183 fi3184 unset NVM_RC_VERSION9 unmodified lines3194 VERSION="$(nvm_version "${provided_version}")" ||:3195 if [ "_${VERSION:-N/A}" = '_N/A' ] && ! nvm_is_valid_version "${provided_version}"; then3196 provided_version=''3197 if [ $has_checked_nvmrc -ne 1 ]; then3197- if [ -n "${NVM_SILENT-}" ]; then3198- nvm_rc_version >/dev/null 2>&1 && has_checked_nvmrc=13199- else3200- nvm_rc_version && has_checked_nvmrc=13198+ NVM_SILENT="${NVM_SILENT:-0}" nvm_rc_version && has_checked_nvmrc=13201- fi3199 fi3200 VERSION="$(nvm_version "${NVM_RC_VERSION}")" ||:3201 unset NVM_RC_VERSION3202 else17 unmodified lines3220 fi3221 if [ "_${VERSION}" = "_N/A" ]; then3222 nvm_ensure_version_installed "${provided_version}"3223 elif [ "${NVM_IOJS}" = true ]; then3227- nvm exec "${NVM_SILENT-}" "${LTS_ARG-}" "${VERSION}" iojs "$@"3224+ nvm exec "${NVM_SILENT_ARG-}" "${LTS_ARG-}" "${VERSION}" iojs "$@"3225 else3229- nvm exec "${NVM_SILENT-}" "${LTS_ARG-}" "${VERSION}" node "$@"3226+ nvm exec "${NVM_SILENT_ARG-}" "${LTS_ARG-}" "${VERSION}" node "$@"3227 fi3228 EXIT_CODE="$?"3229 return $EXIT_CODE3230 ;;1 unmodified line3232 local NVM_SILENT3233 local NVM_LTS3234 while [ $# -gt 0 ]; do3235 case "$1" in3239- --silent) NVM_SILENT='--silent' ; shift ;;3236+ --silent) NVM_SILENT=1 ; shift ;;3237 --lts) NVM_LTS='*' ; shift ;;3238 --lts=*) NVM_LTS="${1##--lts=}" ; shift ;;3239 --) break ;;3240 --*)17 unmodified lines3258 VERSION="${provided_version}"3259 elif [ -n "${provided_version}" ]; then3260 VERSION="$(nvm_version "${provided_version}")" ||:3261 if [ "_${VERSION}" = '_N/A' ] && ! nvm_is_valid_version "${provided_version}"; then3265- if [ -n "${NVM_SILENT-}" ]; then3266- nvm_rc_version >/dev/null 2>&13267- else3268- nvm_rc_version3269- fi3262+ NVM_SILENT="${NVM_SILENT:-0}" nvm_rc_version && has_checked_nvmrc=13263 provided_version="${NVM_RC_VERSION}"3264 unset NVM_RC_VERSION3265 VERSION="$(nvm_version "${provided_version}")" ||:3266 else6 unmodified lines3273 if [ "${EXIT_CODE}" != "0" ]; then3274 return $EXIT_CODE3275 fi3276 3284- if [ -z "${NVM_SILENT-}" ]; then3277+ if [ "${NVM_SILENT:-0}" -ne 1 ]; then3278 if [ "${NVM_LTS-}" = '*' ]; then3279 nvm_echo "Running node latest LTS -> $(nvm_version "${VERSION}")$(nvm use --silent "${VERSION}" && nvm_print_npm_version)"3280 elif [ -n "${NVM_LTS-}" ]; then3281 nvm_echo "Running node LTS \"${NVM_LTS-}\" -> $(nvm_version "${VERSION}")$(nvm use --silent "${VERSION}" && nvm_print_npm_version)"556 unmodified lines