[Perf] Improve performance of listing aliases
Fixes #3054
parent
ea3b65f02e
commit
ffcb5213e2
12
nvm.sh
12
nvm.sh
|
@ -1068,7 +1068,7 @@ nvm_list_aliases() {
|
||||||
|
|
||||||
(
|
(
|
||||||
local ALIAS_NAME
|
local ALIAS_NAME
|
||||||
for ALIAS_NAME in "$(nvm_node_prefix)" "stable" "unstable"; do
|
for ALIAS_NAME in "$(nvm_node_prefix)" "stable" "unstable" "$(nvm_iojs_prefix)"; do
|
||||||
{
|
{
|
||||||
# shellcheck disable=SC2030,SC2031 # (https://github.com/koalaman/shellcheck/issues/2217)
|
# shellcheck disable=SC2030,SC2031 # (https://github.com/koalaman/shellcheck/issues/2217)
|
||||||
if [ ! -f "${NVM_ALIAS_DIR}/${ALIAS_NAME}" ] && { [ -z "${ALIAS}" ] || [ "${ALIAS_NAME}" = "${ALIAS}" ]; }; then
|
if [ ! -f "${NVM_ALIAS_DIR}/${ALIAS_NAME}" ] && { [ -z "${ALIAS}" ] || [ "${ALIAS_NAME}" = "${ALIAS}" ]; }; then
|
||||||
|
@ -1077,11 +1077,6 @@ nvm_list_aliases() {
|
||||||
} &
|
} &
|
||||||
done
|
done
|
||||||
wait
|
wait
|
||||||
ALIAS_NAME="$(nvm_iojs_prefix)"
|
|
||||||
# shellcheck disable=SC2030,SC2031 # (https://github.com/koalaman/shellcheck/issues/2217)
|
|
||||||
if [ ! -f "${NVM_ALIAS_DIR}/${ALIAS_NAME}" ] && { [ -z "${ALIAS}" ] || [ "${ALIAS_NAME}" = "${ALIAS}" ]; }; then
|
|
||||||
NVM_NO_COLORS="${NVM_NO_COLORS-}" NVM_CURRENT="${NVM_CURRENT}" nvm_print_default_alias "${ALIAS_NAME}"
|
|
||||||
fi
|
|
||||||
) | sort
|
) | sort
|
||||||
|
|
||||||
(
|
(
|
||||||
|
@ -1376,9 +1371,10 @@ nvm_ls() {
|
||||||
|
|
||||||
if [ "${NVM_ADD_SYSTEM-}" = true ]; then
|
if [ "${NVM_ADD_SYSTEM-}" = true ]; then
|
||||||
if [ -z "${PATTERN}" ] || [ "${PATTERN}" = 'v' ]; then
|
if [ -z "${PATTERN}" ] || [ "${PATTERN}" = 'v' ]; then
|
||||||
VERSIONS="${VERSIONS}$(command printf '\n%s' 'system')"
|
VERSIONS="${VERSIONS}
|
||||||
|
system"
|
||||||
elif [ "${PATTERN}" = 'system' ]; then
|
elif [ "${PATTERN}" = 'system' ]; then
|
||||||
VERSIONS="$(command printf '%s' 'system')"
|
VERSIONS="system"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue