diff options
Diffstat (limited to 'ves-deactivate.sh')
| -rwxr-xr-x[-rw-r--r--] | ves-deactivate.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/ves-deactivate.sh b/ves-deactivate.sh index 1a24852..3937f93 100644..100755 --- a/ves-deactivate.sh +++ b/ves-deactivate.sh @@ -1 +1,20 @@ #!/bin/sh +# +# Deactivate the currently active sh-ves environment, restoring all +# overridden variables to the values saved by ves_activate. +# +ves_deactivate() { + if [ -z "$SHVES_ENV_NM" ]; then + printf "ERROR: No environment is currently active.\n" >&2 + return 1 + fi + + for var in $SHVES_SAVED_VARS; do + _shves_restore_var "$var" + done + + unset SHVES_SAVED_VARS + unset SHVES_ENV_NM + + return 0 +} |