Ensure that `nvm ls node` doesn't return "node_modules", for example.

master
Jordan Harband 2014-08-01 01:24:28 -07:00
parent 1d37af162a
commit 6dc602b521
2 changed files with 8 additions and 1 deletions

2
nvm.sh
View File

@ -196,7 +196,7 @@ nvm_ls() {
PATTERN="$PATTERN."
fi
VERSIONS=`find "$NVM_DIR/" -maxdepth 1 -type d -name "$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 '^ *\.' | \grep -e '^v'`
fi
if [ -z "$VERSIONS" ]; then
echo "N/A"

View File

@ -0,0 +1,7 @@
#!/bin/sh
. ../../../nvm.sh
nvm ls node
[ "$?" = "3" ]