Only list extant explicit version

master
Andrew Crites 2014-06-12 10:56:20 -04:00
parent 931cc45fc3
commit 0e1f2408c9
1 changed files with 3 additions and 1 deletions

2
nvm.sh
View File

@ -130,7 +130,9 @@ nvm_ls() {
fi fi
# If it looks like an explicit version, don't do anything funny # If it looks like an explicit version, don't do anything funny
if [ `expr "$PATTERN" : "v[[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*$"` != 0 ]; then if [ `expr "$PATTERN" : "v[[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*$"` != 0 ]; then
if [ -d "$NVM_DIR/$PATTERN" ]; then
VERSIONS="$PATTERN" VERSIONS="$PATTERN"
fi
else else
VERSIONS=`find "$NVM_DIR/" -maxdepth 1 -type d -name "$(nvm_format_version $PATTERN)*" -exec basename '{}' ';' \ VERSIONS=`find "$NVM_DIR/" -maxdepth 1 -type d -name "$(nvm_format_version $PATTERN)*" -exec basename '{}' ';' \
| sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n | grep -v '^ *\.'` | sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n | grep -v '^ *\.'`