Use `nvm_num_version_groups` in `nvm_ls`
parent
4b2bc0be08
commit
c992b1766c
10
nvm.sh
10
nvm.sh
|
@ -247,14 +247,18 @@ nvm_ls() {
|
|||
return
|
||||
fi
|
||||
# If it looks like an explicit version, don't do anything funny
|
||||
if [ `expr "$PATTERN" : "v[0-9]*\.[0-9]*\.[0-9]*$"` != 0 ]; then
|
||||
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 [ `expr "$PATTERN" : "v[0-9]*\.[0-9]*$"` != 0 ]; then
|
||||
PATTERN="$PATTERN."
|
||||
if [ "~$PATTERN" != "~system" ]; then
|
||||
local NUM_VERSION_GROUPS
|
||||
NUM_VERSION_GROUPS="$(nvm_num_version_groups "$PATTERN")"
|
||||
if [ "~$NUM_VERSION_GROUPS" = "~2" ] || [ "~$NUM_VERSION_GROUPS" = "~1" ]; then
|
||||
PATTERN="$(echo "$PATTERN" | sed -e 's/\.*$//g')."
|
||||
fi
|
||||
fi
|
||||
if [ -d "$(nvm_version_dir new)" ]; then
|
||||
VERSIONS=`find "$(nvm_version_dir new)/" "$(nvm_version_dir old)/" -maxdepth 1 -type d -name "$PATTERN*" -exec basename '{}' ';' \
|
||||
|
|
Loading…
Reference in New Issue