Skip to content
Myr

Merge pull request #1011 from dohse/keep-parameters

Before adoption: this commit came in with the history the project adopted, so no landing records it.

[Fix] Do not modify args of sourcing script when parsing `--install`/`--no-use` arg Fixes #976.

authored by Jordan Harband · committed by Jordan Harband · parents dc9020b, 7135873 · Browse files · 2 files+24 added−13 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+24 added−13 removed

  • tests:+5 added−0 removed
  • other:+19 added−13 removed

2 files+24 added−13 removed

added:test/fast/Sourcing nvm.sh should not modify parameters of caller+5 added
1#!/bin/sh23set -- yes4. ../../nvm.sh5[ "$1" = yes ]
modified:nvm.sh+19 added-13 removed
2375 unmodified lines
2376 nvm_version_greater nvm_version_greater_than_or_equal_to \2377 nvm_print_npm_version nvm_npm_global_modules \2378 nvm_has_system_node nvm_has_system_iojs \2379 nvm_download nvm_get_latest nvm_has nvm_get_latest \2380 nvm_supports_source_options nvm_auto nvm_supports_xz > /dev/null 2>&12380 nvm_supports_source_options nvm_auto nvm_supports_xz \2381 nvm_process_parameters > /dev/null 2>&12382 unset RC_VERSION NVM_NODEJS_ORG_MIRROR NVM_DIR NVM_CD_FLAGS > /dev/null 2>&12383 ;;2384 * )2385 >&2 nvm help
33 unmodified lines
2419 return 12420 fi2421}24222423nvm_process_parameters() {2424 local NVM_AUTO_MODE2422NVM_AUTO_MODE='use'2423if nvm_supports_source_options; then2424 while [ $# -ne 0 ]2425 do2426 case "$1" in2427 --install) NVM_AUTO_MODE='install' ;;2428 --no-use) NVM_AUTO_MODE='none' ;;2429 esac2430 shift2431 done2432fi2433nvm_auto "$NVM_AUTO_MODE"2425 NVM_AUTO_MODE='use'2426 if nvm_supports_source_options; then2427 while [ $# -ne 0 ]2428 do2429 case "$1" in2430 --install) NVM_AUTO_MODE='install' ;;2431 --no-use) NVM_AUTO_MODE='none' ;;2432 esac2433 shift2434 done2435 fi2436 nvm_auto "$NVM_AUTO_MODE"2437}24382439nvm_process_parameters "$@"24402441} # this ensures the entire script is downloaded #