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

Code before:
            shift
          ;;
          --lts=*)
            LTS="${1##--lts=}"
            shift
          ;;
          --latest-npm)
            NVM_UPGRADE_NPM=1
            shift
          ;;
          --default)
            ALIAS='node'
            shift
          ;;
          --alias=*)
            ALIAS="${1##--alias=}"
            shift
          ;;
          *)
            break # stop parsing args
          ;;
        esac
      done

      if [ -n "${ALIAS}" ]; then
        nvm alias default "${ALIAS}"
      fi

      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
          provided_version="$NVM_RC_VERSION"
          unset NVM_RC_VERSION

Review comment (suggestion):
The intention was that `nvm install --alias=foo 8` would be like `nvm install 8 && nvm alias foo 8` - in other words, `--default` is a shortcut for `--alias=default`.
```suggestion
        nvm alias "${ALIAS}" $provided_version
```

Separately, this step shouldn't happen until after the installation is completed.

Code after:
          ;;
          --no-progress)
            noprogress=1
            shift
          ;;
          --lts)
            LTS='*'
            shift
          ;;
          --lts=*)
            LTS="${1##--lts=}"
            shift
          ;;
          --latest-npm)
            NVM_UPGRADE_NPM=1
            shift
          ;;
          --default)
            if [ -n "${ALIAS-}" ]; then
              nvm_err '--default and --alias are mutually exclusive, and may not be provided more than once'
              return 6
            fi
            ALIAS='default'
            shift
          ;;
          --alias=*)
            if [ -n "${ALIAS-}" ]; then
              nvm_err '--default and --alias are mutually exclusive, and may not be provided more than once'
              return 6
            fi
            ALIAS="${1##--alias=}"
            shift
          ;;
          --reinstall-packages-from=*)
            if [ -n "${PROVIDED_REINSTALL_PACKAGES_FROM-}" ]; then
              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}")" ||:
            shift
          ;;
          --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