Check for versions like v0.9

Users might ask for a v0.x version (`nvm use v0.9` for example). So we check for v* versions that have no patch number.
We do that because v?*.?*.?* does not match 'vX.Y'.
This commit is contained in:
Julien Durillon
2012-12-13 17:23:03 +01:00
parent bc508802e5
commit 3f7aba2e46

3
nvm.sh
View File

@@ -61,6 +61,9 @@ nvm_ls()
if [[ "$PATTERN" == v?*.?*.?* ]]; then
VERSIONS="$PATTERN"
else
if [[ "$PATTERN" == v* ]]; then
PATTERN=${PATTERN/v//}
fi
VERSIONS=`(cd $NVM_DIR; \ls -d v${PATTERN}* 2>/dev/null) | sort -t. -k 1.2,1n -k 2,2n -k 3,3n`
fi
if [ ! "$VERSIONS" ]; then