This commit is contained in:
GitHub Merge Button 2012-02-20 07:28:36 -08:00
commit 575d98cf23

10
nvm.sh
View File

@ -97,6 +97,7 @@ nvm()
echo " nvm alias <name> <version> Set an alias named <name> pointing to <version>" echo " nvm alias <name> <version> Set an alias named <name> pointing to <version>"
echo " nvm unalias <name> Deletes the alias named <name>" 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 copy-packages <version> Install global NPM packages contained in <version> to current version"
echo " nvm versions List available versions"
echo echo
echo "Example:" echo "Example:"
echo " nvm install v0.4.12 Install a specific version number" echo " nvm install v0.4.12 Install a specific version number"
@ -111,7 +112,11 @@ nvm()
return return
fi fi
[ "$NOCURL" ] && curl && return [ "$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 [ -d "$NVM_DIR/$VERSION" ] && echo "$VERSION is already installed." && return
@ -299,6 +304,9 @@ nvm()
"version" ) "version" )
print_versions "`nvm_version $2`" print_versions "`nvm_version $2`"
;; ;;
"versions" )
curl -s -o - http://nodejs.org/dist/ | grep -oE 'v[0-9]\.[0-9]\.[0-9]' | sort -u
;;
* ) * )
nvm help nvm help
;; ;;