[performance] `nvm_auto`: only call `nvm_ls_current` in `use` mode
parent
19c55b9936
commit
f7fbad2bd6
4
nvm.sh
4
nvm.sh
|
@ -3788,11 +3788,10 @@ nvm_supports_xz() {
|
||||||
}
|
}
|
||||||
|
|
||||||
nvm_auto() {
|
nvm_auto() {
|
||||||
local NVM_CURRENT
|
|
||||||
NVM_CURRENT="$(nvm_ls_current)"
|
|
||||||
local NVM_MODE
|
local NVM_MODE
|
||||||
NVM_MODE="${1-}"
|
NVM_MODE="${1-}"
|
||||||
local VERSION
|
local VERSION
|
||||||
|
local NVM_CURRENT
|
||||||
if [ "_${NVM_MODE}" = '_install' ]; then
|
if [ "_${NVM_MODE}" = '_install' ]; then
|
||||||
VERSION="$(nvm_alias default 2>/dev/null || nvm_echo)"
|
VERSION="$(nvm_alias default 2>/dev/null || nvm_echo)"
|
||||||
if [ -n "${VERSION}" ]; then
|
if [ -n "${VERSION}" ]; then
|
||||||
|
@ -3801,6 +3800,7 @@ nvm_auto() {
|
||||||
nvm install >/dev/null
|
nvm install >/dev/null
|
||||||
fi
|
fi
|
||||||
elif [ "_$NVM_MODE" = '_use' ]; then
|
elif [ "_$NVM_MODE" = '_use' ]; then
|
||||||
|
NVM_CURRENT="$(nvm_ls_current)"
|
||||||
if [ "_${NVM_CURRENT}" = '_none' ] || [ "_${NVM_CURRENT}" = '_system' ]; then
|
if [ "_${NVM_CURRENT}" = '_none' ] || [ "_${NVM_CURRENT}" = '_system' ]; then
|
||||||
VERSION="$(nvm_resolve_local_alias default 2>/dev/null || nvm_echo)"
|
VERSION="$(nvm_resolve_local_alias default 2>/dev/null || nvm_echo)"
|
||||||
if [ -n "${VERSION}" ]; then
|
if [ -n "${VERSION}" ]; then
|
||||||
|
|
Loading…
Reference in New Issue