nvm_num_version_groups should report 0 when given just a v or a .

This commit is contained in:
Jordan Harband
2015-04-06 11:10:43 -07:00
parent 3d764e6833
commit c34502ebc2
2 changed files with 6 additions and 2 deletions

4
nvm.sh
View File

@@ -333,12 +333,12 @@ nvm_format_version() {
nvm_num_version_groups() {
local VERSION
VERSION="$1"
VERSION="${VERSION#v}"
VERSION="${VERSION%.}"
if [ -z "$VERSION" ]; then
echo "0"
return
fi
VERSION="${VERSION#v*}"
VERSION="${VERSION%\.}"
local NVM_NUM_DOTS
NVM_NUM_DOTS=$(echo "$VERSION" | command sed -e 's/[^\.]//g')
local NVM_NUM_GROUPS