Updated fix for issues #232 and #244

Fixes issues #232 and #244 where "nvm ls" returns inconsistent results depending on the number of node versions installed.  This updated fix uses the find and sort commands only.  Tested in bash v3.2.48 and v4.2.25, and zsh v4.3.11.
master
Derek Keller 2013-06-09 21:44:46 -05:00
parent bc04ed3ece
commit d1d53ea979
1 changed files with 1 additions and 3 deletions

4
nvm.sh
View File

@ -79,9 +79,7 @@ nvm_ls()
if [[ "$PATTERN" == v?*.?*.?* ]]; then if [[ "$PATTERN" == v?*.?*.?* ]]; then
VERSIONS="$PATTERN" VERSIONS="$PATTERN"
else else
VERSIONS=`find $NVM_DIR -type d -name "v$PATTERN*" -print \ VERSIONS=`find "$NVM_DIR/" -maxdepth 1 -type d -name "v$PATTERN*" -exec basename '{}' ';' \
| tr '\n' '\0' \
| xargs -0 -n 1 basename 2>/dev/null \
| sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n` | sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n`
fi fi
if [ ! "$VERSIONS" ]; then if [ ! "$VERSIONS" ]; then