nvm_ls: format the version immediately, so that `nvm ls 0.0.1` doesn't return `nvm ls 0.0.10`

master
Jordan Harband 2014-09-28 10:14:27 -07:00
parent be605cb12b
commit b707d8b072
1 changed files with 2 additions and 2 deletions

4
nvm.sh
View File

@ -255,12 +255,12 @@ nvm_ls() {
return
fi
# If it looks like an explicit version, don't do anything funny
if [ "_$(echo "$PATTERN" | cut -c1-1)" = "_v" ] && [ "_$(nvm_num_version_groups "$PATTERN")" = "_3" ]; then
PATTERN=$(nvm_format_version $PATTERN)
if [ "_$(echo "$PATTERN" | cut -c1-1)" = "_v" ] && [ "_$(nvm_num_version_groups "$PATTERN")" = "_3" ]; then
if [ -d "$(nvm_version_path "$PATTERN")" ]; then
VERSIONS="$PATTERN"
fi
else
PATTERN=$(nvm_format_version $PATTERN)
if [ "_$PATTERN" != "_system" ]; then
local NUM_VERSION_GROUPS
NUM_VERSION_GROUPS="$(nvm_num_version_groups "$PATTERN")"