mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-11 14:51:49 +00:00
[New] adding default and alias option to nvm install
--alias=8 is equivalent to `nvm alias default 8` --default is equivalent to `nvm alias default node`
This commit is contained in:
parent
caf6208dbd
commit
dd0074ccde
15
nvm.sh
15
nvm.sh
@ -2397,6 +2397,8 @@ nvm() {
|
|||||||
nvm_echo ' --skip-default-packages When installing, skip the default-packages file if it exists'
|
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 ' --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 ' --no-progress Disable the progress bar on any downloads'
|
||||||
|
nvm_echo ' --alias=<default version> After installing, set default alias to the version specified. (same as: nvm alias default <version>)'
|
||||||
|
nvm_echo ' --default After installing, set default alias to latest version available. (same as: nvm alias default node)'
|
||||||
nvm_echo ' nvm uninstall <version> Uninstall a 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 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.'
|
nvm_echo ' nvm uninstall --lts=<LTS name> Uninstall using automatic alias for provided LTS line, if available.'
|
||||||
@ -2552,6 +2554,7 @@ nvm() {
|
|||||||
nobinary=0
|
nobinary=0
|
||||||
noprogress=0
|
noprogress=0
|
||||||
local LTS
|
local LTS
|
||||||
|
local ALIAS
|
||||||
local NVM_UPGRADE_NPM
|
local NVM_UPGRADE_NPM
|
||||||
NVM_UPGRADE_NPM=0
|
NVM_UPGRADE_NPM=0
|
||||||
while [ $# -ne 0 ]
|
while [ $# -ne 0 ]
|
||||||
@ -2582,12 +2585,24 @@ nvm() {
|
|||||||
NVM_UPGRADE_NPM=1
|
NVM_UPGRADE_NPM=1
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--default)
|
||||||
|
ALIAS='node'
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--alias=*)
|
||||||
|
ALIAS="${1:-}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
break # stop parsing args
|
break # stop parsing args
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ -n "${ALIAS}" ]; then
|
||||||
|
nvm alias default "${ALIAS}"
|
||||||
|
fi
|
||||||
|
|
||||||
local provided_version
|
local provided_version
|
||||||
provided_version="${1-}"
|
provided_version="${1-}"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user