From 865d2fe3d6dacec99cd3d61b87992f9a91c89733 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sun, 17 Apr 2016 23:39:27 -0700 Subject: [PATCH] Include LTS version in `nvm_ls_remote` output. --- nvm.sh | 10 +++++++--- test/fast/Unit tests/mocks/nvm_ls_remote.txt | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/nvm.sh b/nvm.sh index 7b4559f..622ff69 100644 --- a/nvm.sh +++ b/nvm.sh @@ -903,7 +903,7 @@ nvm_ls_remote_index_tab() { PATTERN="$(nvm_ensure_version_prefix "$PATTERN")" fi else - PATTERN=".*" + unset PATTERN fi ZSH_HAS_SHWORDSPLIT_UNSET=1 if nvm_has "setopt"; then @@ -914,8 +914,12 @@ nvm_ls_remote_index_tab() { | command sed " 1d; s/^/$PREFIX/; - s/[[:blank:]].*//" \ - | nvm_grep -w "$PATTERN" \ + " \ + | command awk -v pattern="${PATTERN-}" '{ + if (!$1) { next } + if (pattern && tolower($1) !~ tolower(pattern)) { next } + if ($10 !~ /^\-?$/ && ! a[$10]++) print $1, $10; else print $1 + }' \ | $SORT_COMMAND)" if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then unsetopt shwordsplit diff --git a/test/fast/Unit tests/mocks/nvm_ls_remote.txt b/test/fast/Unit tests/mocks/nvm_ls_remote.txt index 0c98561..c6f2e8f 100644 --- a/test/fast/Unit tests/mocks/nvm_ls_remote.txt +++ b/test/fast/Unit tests/mocks/nvm_ls_remote.txt @@ -251,7 +251,7 @@ v4.4.3 v4.4.4 v4.4.5 v4.4.6 -v4.4.7 +v4.4.7 Argon v5.0.0 v5.1.0 v5.1.1