mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-10 22:31:51 +00:00
add an "nvm versions" argument to list available versions
get the lastest node with "nvm intall latest"
This commit is contained in:
parent
4692f496da
commit
82c40f1148
10
nvm.sh
10
nvm.sh
@ -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
|
||||
;;
|
||||
|
Loading…
Reference in New Issue
Block a user