From f5f029c40919645011d7562b7fe3bf8aa0a5ddf9 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Thu, 24 May 2018 12:23:02 -0400 Subject: [PATCH] =?UTF-8?q?[Fix]=20=E2=80=9Cunstable=E2=80=9D=20alias:=20w?= =?UTF-8?q?hen=20there=E2=80=99s=20no=20=E2=80=9Cunstable=E2=80=9D=20minor?= =?UTF-8?q?s,=20output=20=E2=80=9CN/A=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nvm.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nvm.sh b/nvm.sh index 5ed70ae..c23c035 100644 --- a/nvm.sh +++ b/nvm.sh @@ -1107,7 +1107,13 @@ nvm_ls_remote() { local PATTERN PATTERN="${1-}" if nvm_validate_implicit_alias "${PATTERN}" 2> /dev/null ; then - PATTERN="$(NVM_LTS="${NVM_LTS-}" nvm_ls_remote "$(nvm_print_implicit_alias remote "${PATTERN}")" | command tail -1 | command awk '{ print $1 }')" + local IMPLICIT + IMPLICIT="$(nvm_print_implicit_alias remote "${PATTERN}")" + if [ -z "${IMPLICIT-}" ] || [ "${IMPLICIT}" = 'N/A' ]; then + nvm_echo "N/A" + return 3 + fi + PATTERN="$(NVM_LTS="${NVM_LTS-}" nvm_ls_remote "${IMPLICIT}" | command tail -1 | command awk '{ print $1 }')" elif [ -n "${PATTERN}" ]; then PATTERN="$(nvm_ensure_version_prefix "${PATTERN}")" else @@ -1590,7 +1596,7 @@ nvm_print_implicit_alias() { if [ "_$2" = '_stable' ]; then nvm_echo "${STABLE}" elif [ "_$2" = '_unstable' ]; then - nvm_echo "${UNSTABLE}" + nvm_echo "${UNSTABLE:-"N/A"}" fi }