From b59ecb9e11d9e74431b9a7140153d5fe669d13f5 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Thu, 21 Aug 2014 22:54:26 -0700 Subject: [PATCH] Make sure the new `versions` directory is filtered out of nvm_ls output (in zsh). --- nvm.sh | 2 +- ...ning \"nvm ls\" should filter out \"versions\"" | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100755 "test/fast/Listing versions/Running \"nvm ls\" should filter out \"versions\"" diff --git a/nvm.sh b/nvm.sh index bea76ee..858b0cc 100644 --- a/nvm.sh +++ b/nvm.sh @@ -231,7 +231,7 @@ nvm_ls() { fi if [ -d "$(nvm_version_dir new)" ]; then VERSIONS=`find "$(nvm_version_dir new)/" "$(nvm_version_dir old)/" -maxdepth 1 -type d -name "$PATTERN*" -exec basename '{}' ';' \ - | sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n | \grep -v '^ *\.' | \grep -e '^v'` + | sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n | \grep -v '^ *\.' | \grep -e '^v' | \grep -v -e '^versions$'` else VERSIONS=`find "$(nvm_version_dir old)/" -maxdepth 1 -type d -name "$PATTERN*" -exec basename '{}' ';' \ | sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n | \grep -v '^ *\.' | \grep -e '^v'` diff --git "a/test/fast/Listing versions/Running \"nvm ls\" should filter out \"versions\"" "b/test/fast/Listing versions/Running \"nvm ls\" should filter out \"versions\"" new file mode 100755 index 0000000..c9858df --- /dev/null +++ "b/test/fast/Listing versions/Running \"nvm ls\" should filter out \"versions\"" @@ -0,0 +1,14 @@ +#!/bin/sh + +mkdir ../../../v0.1.3 +mkdir ../../../v0.2.3 + +. ../../../nvm.sh + +mkdir ../../../versions + +[ -z "$(nvm ls | \grep 'versions')" ] +# The result should contain only the appropriate version numbers. + +rmdir ../../../versions +