Skip to content

Commit 5b9fcb3

Browse files
[Refactor] Make the code a little bit cleaner
1 parent 7b253c8 commit 5b9fcb3

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

nvm.sh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -297,15 +297,13 @@ nvm_ensure_version_installed() {
297297
if [ "${EXIT_CODE}" != "0" ] || ! nvm_is_version_installed "${LOCAL_VERSION}"; then
298298
if VERSION="$(nvm_resolve_alias "${PROVIDED_VERSION}")"; then
299299
nvm_err "N/A: version \"${PROVIDED_VERSION} -> ${VERSION}\" is not yet installed."
300-
nvm_err ""
301-
nvm_err "You need to run \"nvm install ${PROVIDED_VERSION}\" to install it before using it."
302300
else
303301
local PREFIXED_VERSION
304302
PREFIXED_VERSION="$(nvm_ensure_version_prefix "${PROVIDED_VERSION}")"
305303
nvm_err "N/A: version \"${PREFIXED_VERSION:-$PROVIDED_VERSION}\" is not yet installed."
306-
nvm_err ""
307-
nvm_err "You need to run \"nvm install ${PROVIDED_VERSION}\" to install it before using it."
308304
fi
305+
nvm_err ""
306+
nvm_err "You need to run \"nvm install ${PROVIDED_VERSION}\" to install it before using it."
309307
return 1
310308
fi
311309
}
@@ -726,8 +724,7 @@ nvm_resolve_alias() {
726724
break
727725
fi
728726

729-
if [ -n "${ALIAS_TEMP}" ] \
730-
&& command printf "${SEEN_ALIASES}" | nvm_grep -e "^${ALIAS_TEMP}$" > /dev/null; then
727+
if command printf "${SEEN_ALIASES}" | nvm_grep -e "^${ALIAS_TEMP}$" > /dev/null; then
731728
ALIAS=""
732729
break
733730
fi

0 commit comments

Comments
 (0)