[New] adding default and alias option to `nvm install`

For: `nvm install 8.12.0` after install:

--alias=8 is equivalent to `nvm alias 8 8.12.0`
--default is equivalent to `nvm alias default 8.12.0`

Co-authored-by: Kayla Altepeter <kayla@kaylaaltepeter.com>
Co-authored-by: Dena Burd <me@Denas-MacBook-Air.local>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
diff --git a/nvm.sh b/nvm.sh
index c4a80af..98aaf97 100644
--- a/nvm.sh
+++ b/nvm.sh
@@ -1771,6 +1771,10 @@
     command mv "${TMPDIR}/"* "${VERSION_PATH}" && \
     command rm -rf "${TMPDIR}"
   ); then
+
+    if [ -n "${ALIAS-}" ]; then
+      nvm alias "${ALIAS}" "${provided_version}"
+    fi
     return 0
   fi
 
@@ -2370,6 +2374,8 @@
       nvm_echo '    --skip-default-packages                   When installing, skip the default-packages file if it exists'
       nvm_echo '    --latest-npm                              After installing, attempt to upgrade to the latest working npm on the given node version'
       nvm_echo '    --no-progress                             Disable the progress bar on any downloads'
+      nvm_echo '    --alias=<name>                            After installing, set the alias specified to the version specified. (same as: nvm alias <name> <version>)'
+      nvm_echo '    --default                                 After installing, set default alias to the version specified. (same as: nvm alias default <version>)'
       nvm_echo '  nvm uninstall <version>                     Uninstall a version'
       nvm_echo '  nvm uninstall --lts                         Uninstall using automatic LTS (long-term support) alias `lts/*`, if available.'
       nvm_echo '  nvm uninstall --lts=<LTS name>              Uninstall using automatic alias for provided LTS line, if available.'
@@ -2546,6 +2552,7 @@
       nobinary=0
       noprogress=0
       local LTS
+      local ALIAS
       local NVM_UPGRADE_NPM
       NVM_UPGRADE_NPM=0
 
@@ -2585,6 +2592,22 @@
             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'
@@ -2766,6 +2789,11 @@
         else
           nvm_ensure_default_set "${provided_version}"
         fi
+
+        if [ -n "${ALIAS}" ]; then
+          nvm alias "${ALIAS}" "${provided_version}"
+        fi
+
         return $?
       fi
 
diff --git a/test/installation_node/install with --alias b/test/installation_node/install with --alias
new file mode 100755
index 0000000..8be8cbd
--- /dev/null
+++ b/test/installation_node/install with --alias
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -ex
+
+die () { echo "$@" ; exit 1; }
+
+\. ../../nvm.sh
+
+nvm install --alias=9 9.11.2 || die '`nvm install --alias=9 9.11.2` failed'
+
+TERM=dumb nvm alias | grep '9 -> 9.11.2 (-> v9.11.2 \*)' || die 'did not make the expected alias'
diff --git a/test/installation_node/install with --default b/test/installation_node/install with --default
new file mode 100755
index 0000000..5a06d34
--- /dev/null
+++ b/test/installation_node/install with --default
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -ex
+
+die () { echo "$@" ; exit 1; }
+
+\. ../../nvm.sh
+
+nvm install --default node || die '`nvm install --default` failed'
+
+TERM=dumb nvm alias | grep "default -> node (-> $(nvm version node) \*)" || die 'did not make the expected alias'