Merge pull request #376 from koenpunt/nvm-unload

Feature: nvm unload
master
Jordan Harband 2014-05-28 20:53:50 -07:00
commit 6aa45732d8
2 changed files with 16 additions and 0 deletions

5
nvm.sh
View File

@ -249,6 +249,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 unload Unload NVM from shell"
echo
echo "Example:"
echo " nvm install v0.10.24 Install a specific version number"
@ -627,6 +628,10 @@ nvm() {
"--version" )
echo "0.7.0"
;;
"unload" )
unset -f nvm nvm_print_versions nvm_checksum nvm_ls_remote nvm_ls nvm_remote_version nvm_version nvm_rc_version > /dev/null 2>&1
unset RC_VERSION NVM_NODEJS_ORG_MIRROR NVM_DIR NVM_CD_FLAGS > /dev/null 2>&1
;;
* )
nvm help
;;

View File

@ -0,0 +1,11 @@
#!/bin/sh
fail () { echo $@ ; exit 1; }
. ../../nvm.sh
type nvm > /dev/null 2>&1 || fail "NVM not loaded"
nvm unload
type nvm > /dev/null 2>&1 && fail "NVM not unloaded" || exit 0