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

Code before:
              nvm_err '--reinstall-packages-from may not be provided more than once'
              return 6
            fi
            PROVIDED_REINSTALL_PACKAGES_FROM="$(nvm_echo "$1" | command cut -c 27-)"
            if [ -z "${PROVIDED_REINSTALL_PACKAGES_FROM}" ]; then
              nvm_err 'If --reinstall-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}")" ||:
          ;;
          --copy-packages-from=*)
            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}")" ||:
          ;;
          --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
          ;;
          *)
            ADDITIONAL_PARAMETERS="${ADDITIONAL_PARAMETERS} $1"
          ;;
        esac
        shift
      done

      if [ -z "${SKIP_DEFAULT_PACKAGES-}" ]; then
        DEFAULT_PACKAGES="$(nvm_get_default_packages)"
        EXIT_CODE=$?
        if [ $EXIT_CODE -ne 0 ]; then
          return $EXIT_CODE
        fi
      fi

      if [ -n "${PROVIDED_REINSTALL_PACKAGES_FROM-}" ] && [ "$(nvm_ensure_version_prefix "${PROVIDED_REINSTALL_PACKAGES_FROM}")" = "${VERSION}" ]; then
        nvm_err "You can't reinstall global packages from the same version of node you're installing."
        return 4
      elif [ "${REINSTALL_PACKAGES_FROM-}" = 'N/A' ]; then
        nvm_err "If --reinstall-packages-from is provided, it must point to an installed version of node."
        return 5
      fi

Review comment (suggestion):
```suggestion
      local NVM_WRITE_TO_NVMRC
      NVM_WRITE_TO_NVMRC=0
```
this is needed for dash

Code after:
      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'
                return 6