add an "nvm versions" argument to list available versions

get the lastest node with "nvm intall latest"
This commit is contained in:
Chris Bell 2011-10-15 09:35:41 -07:00
parent 4692f496da
commit 82c40f1148

10
nvm.sh
View File

@ -85,6 +85,7 @@ nvm()
echo " nvm alias <name> <version> Set an alias named <name> pointing to <version>"
echo " nvm unalias <name> Deletes the alias named <name>"
echo " nvm copy-packages <version> Install global NPM packages contained in <version> to current version"
echo " nvm versions List available versions"
echo
echo "Example:"
echo " nvm install v0.4.12 Install a specific version number"
@ -98,7 +99,11 @@ nvm()
return
fi
[ "$NOCURL" ] && curl && return
VERSION=`nvm_version $2`
if [ $2 == latest ]; then
VERSION=$(nvm versions | tail -1)
else
VERSION=`nvm_version $2`
fi
[ -d "$NVM_DIR/$VERSION" ] && echo "$VERSION is already installed." && return
@ -264,6 +269,9 @@ nvm()
"version" )
nvm_version $2
;;
"versions" )
curl -s -o - http://nodejs.org/dist/ | grep -oE 'v[0-9]\.[0-9]\.[0-9]' | sort -u
;;
* )
nvm help
;;