Repository: nvm-sh/nvm
File: nvm.sh (Shell)

Code before:
            if [ -n "${PROVIDED_REINSTALL_PACKAGES_FROM-}" ]; then
              nvm_err '--reinstall-packages-from may not be provided more than once, or combined with `--copy-packages-from`'
              return 6
            fi
            PROVIDED_REINSTALL_PACKAGES_FROM="$(nvm_echo "$1" | command cut -c 22-)"
            if [ -z "${PROVIDED_REINSTALL_PACKAGES_FROM}" ]; then
              nvm_err 'If --copy-packages-from is provided, it must point to an installed version of node.'
              return 6
            fi
            REINSTALL_PACKAGES_FROM="$(nvm_version "${PROVIDED_REINSTALL_PACKAGES_FROM}")" ||:
            shift
          ;;
          --reinstall-packages-from | --copy-packages-from)
            nvm_err "If ${1} is provided, it must point to an installed version of node using \`=\`."
            return 6
          ;;
          --skip-default-packages)
            SKIP_DEFAULT_PACKAGES=true
            shift
          ;;
          --save)
            NVM_WRITE_TO_NVMRC=1
            shift
          ;;
          *)
            break # stop parsing args
          ;;
        esac
      done

      local provided_version
      provided_version="${1-}"

      if [ -z "${provided_version}" ]; then
        if [ "_${LTS-}" = '_*' ]; then
          nvm_echo 'Installing latest LTS version.'
          if [ $# -gt 0 ]; then
            shift
          fi
        elif [ "_${LTS-}" != '_' ]; then
          nvm_echo "Installing with latest version of LTS line: ${LTS}"
          if [ $# -gt 0 ]; then
            shift
          fi
        else
          nvm_rc_version
          if [ $version_not_provided -eq 1 ] && [ -z "${NVM_RC_VERSION}" ]; then
            unset NVM_RC_VERSION
            >&2 nvm --help
            return 127
          fi

Review comment (suggestion):
```suggestion
      local NVM_WRITE_TO_NVMRC
      NVM_WRITE_TO_NVMRC=0
```
to make sure it's set in every code path

Code after:
    "install" | "i")
      local version_not_provided
      version_not_provided=0
      local NVM_OS
      NVM_OS="$(nvm_get_os)"

      if ! nvm_has "curl" && ! nvm_has "wget"; then
        nvm_err 'nvm needs curl or wget to proceed.'
        return 1
      fi

      if [ $# -lt 1 ]; then
        version_not_provided=1
      fi

      local nobinary
      local nosource
      local noprogress
      nobinary=0
      noprogress=0
      nosource=0
      local LTS
      local ALIAS
      local NVM_UPGRADE_NPM
      NVM_UPGRADE_NPM=0
      local NVM_WRITE_TO_NVMRC
      NVM_WRITE_TO_NVMRC=0

      local PROVIDED_REINSTALL_PACKAGES_FROM
      local REINSTALL_PACKAGES_FROM
      local SKIP_DEFAULT_PACKAGES

      while [ $# -ne 0 ]; do
        case "$1" in
          ---*)
            nvm_err 'arguments with `---` are not supported - this is likely a typo'
            return 55;
          ;;
          -s)
            shift # consume "-s"
            nobinary=1
            if [ $nosource -eq 1 ]; then
                nvm err '-s and -b cannot be set together since they would skip install from both binary and source'
                return 6
            fi
          ;;
          -b)
            shift # consume "-b"
            nosource=1
            if [ $nobinary -eq 1 ]; then
                nvm err '-s and -b cannot be set together since they would skip install from both binary and source'