From 82c40f11484883908f63c94b5ce84a61a5f2557e Mon Sep 17 00:00:00 2001 From: Chris Bell Date: Sat, 15 Oct 2011 09:35:41 -0700 Subject: [PATCH] add an "nvm versions" argument to list available versions get the lastest node with "nvm intall latest" --- nvm.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/nvm.sh b/nvm.sh index e9aa070..aeb8a53 100755 --- a/nvm.sh +++ b/nvm.sh @@ -85,6 +85,7 @@ nvm() echo " nvm alias Set an alias named pointing to " echo " nvm unalias Deletes the alias named " echo " nvm copy-packages Install global NPM packages contained in 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 ;;