Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing `nvm ls 0.x` to only include `0.x.*` instead of `0.x*.*`

  • Loading branch information...
commit 4cfe62d3d1ded585598c246d2df45567c96037c9 1 parent 802f064
@ljharb ljharb authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 nvm.sh
View
6 nvm.sh
@@ -158,7 +158,11 @@ nvm_ls() {
VERSIONS="$PATTERN"
fi
else
- VERSIONS=`find "$NVM_DIR/" -maxdepth 1 -type d -name "$(nvm_format_version $PATTERN)*" -exec basename '{}' ';' \
+ PATTERN=$(nvm_format_version $PATTERN)
+ if [ `expr "$PATTERN" : "v[[:digit:]]*\.[[:digit:]]*$"` != 0 ]; then
+ 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 '^ *\.'`
fi
if [ -z "$VERSIONS" ]; then
Please sign in to comment.
Something went wrong with that request. Please try again.