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
parent
bc04ed3ece
commit
d1d53ea979
4
nvm.sh
4
nvm.sh
|
@ -79,9 +79,7 @@ nvm_ls()
|
|||
if [[ "$PATTERN" == v?*.?*.?* ]]; then
|
||||
VERSIONS="$PATTERN"
|
||||
else
|
||||
VERSIONS=`find $NVM_DIR -type d -name "v$PATTERN*" -print \
|
||||
| tr '\n' '\0' \
|
||||
| xargs -0 -n 1 basename 2>/dev/null \
|
||||
VERSIONS=`find "$NVM_DIR/" -maxdepth 1 -type d -name "v$PATTERN*" -exec basename '{}' ';' \
|
||||
| sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n`
|
||||
fi
|
||||
if [ ! "$VERSIONS" ]; then
|
||||
|
|
Loading…
Reference in New Issue