Use `nvm_normalize_version` in `nvm_version_greater`

master
Jordan Harband 2014-09-15 09:17:27 -07:00
parent 97d4e2f88f
commit f6e0104685
1 changed files with 3 additions and 3 deletions

6
nvm.sh
View File

@ -106,9 +106,9 @@ nvm_rc_version() {
nvm_version_greater() { nvm_version_greater() {
local LHS local LHS
LHS=$(echo "$1" | awk -F. '{for (i=1;i<=NF;++i) printf "%010d",$i}') LHS=$(nvm_normalize_version "$1")
local RHS local RHS
RHS=$(echo "$2" | awk -F. '{for (i=1;i<=NF;++i) printf "%010d",$i}') RHS=$(nvm_normalize_version "$2")
[ $LHS -gt $RHS ]; [ $LHS -gt $RHS ];
} }
@ -174,7 +174,7 @@ nvm_remote_version() {
} }
nvm_normalize_version() { nvm_normalize_version() {
echo "$1" | sed -e 's/^v//' | \awk -F. '{ printf("%d%03d%03d\n", $1,$2,$3); }' echo "$1" | sed -e 's/^v//' | \awk -F. '{ printf("%d%06d%06d\n", $1,$2,$3); }'
} }
nvm_format_version() { nvm_format_version() {