diff --git a/nvm.sh b/nvm.sh index 2a50766..8ac13ea 100644 --- a/nvm.sh +++ b/nvm.sh @@ -249,6 +249,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 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 ;; diff --git "a/test/fast/Running \"nvm unload\" should unset all function and variables." "b/test/fast/Running \"nvm unload\" should unset all function and variables." new file mode 100755 index 0000000..bbb4343 --- /dev/null +++ "b/test/fast/Running \"nvm unload\" should unset all function and variables." @@ -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 \ No newline at end of file