1
0
mirror of https://github.com/Tarrasch/zsh-autoenv.git synced 2024-11-22 07:20:59 +02:00

Unset $autoenv_env_file when leaving

This allows to use $autoenv_env_file e.g. in your prompt to see what
.env is being used.
This commit is contained in:
Daniel Hahler 2015-04-24 17:36:37 +02:00
parent fd54606830
commit 470841ac3c
2 changed files with 12 additions and 0 deletions

View File

@ -256,6 +256,9 @@ _autoenv_source() {
# This should not get done for recursion (via autoenv_source_parent), # This should not get done for recursion (via autoenv_source_parent),
# and can be useful to have in general after autoenv was used. # and can be useful to have in general after autoenv was used.
# unset autoenv_event autoenv_from_dir autoenv_to_dir autoenv_env_file # unset autoenv_event autoenv_from_dir autoenv_to_dir autoenv_env_file
if [[ $autoenv_event == leave ]]; then
unset autoenv_env_file
fi
} }
_autoenv_get_file_upwards() { _autoenv_get_file_upwards() {

View File

@ -113,3 +113,12 @@ Test that "leave" is not triggered when entering an outside dir via symlink.
LEFT outside: PWD:leave.t pwd:leave.t from:symlink to:leave.t event:leave LEFT outside: PWD:leave.t pwd:leave.t from:symlink to:leave.t event:leave
$ cd sub/symlink $ cd sub/symlink
ENTERED outside: PWD:symlink pwd:symlink from:leave.t to:symlink event:enter ENTERED outside: PWD:symlink pwd:symlink from:leave.t to:symlink event:enter
$autoenv_env_file should be reset when leaving.
$ echo $autoenv_env_file
*/leave.t/sub/symlink/.env (glob)
$ cd ../..
LEFT outside: PWD:leave.t pwd:leave.t from:symlink to:leave.t event:leave
$ echo ${autoenv_env_file:-empty}
empty