From 744507b83e690b3349fa3072dead8d76baa66b8e Mon Sep 17 00:00:00 2001 From: Koen Punt Date: Sun, 16 Mar 2014 18:09:54 +0100 Subject: [PATCH 1/2] added nvm unload method to remove nvm from shell --- nvm.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nvm.sh b/nvm.sh index 92a3fca..4b8bc78 100644 --- a/nvm.sh +++ b/nvm.sh @@ -218,6 +218,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" @@ -556,6 +557,10 @@ nvm() { "--version" ) echo "nvm v0.3.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 ;; From 703acb0514ae67fd914673018c5c594e155ad65f Mon Sep 17 00:00:00 2001 From: Koen Punt Date: Sun, 16 Mar 2014 18:16:46 +0100 Subject: [PATCH 2/2] Added test for nvm unload --- ...unload\" should unset all function and variables." | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 "test/fast/Running \"nvm unload\" should unset all function and variables." 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