mirror of
https://github.com/Tarrasch/zsh-autoenv.git
synced 2024-11-29 09:50:59 +02:00
Minor cleanup: centralize call to _autoenv_stack_entered_add
This commit is contained in:
parent
7d970a03f7
commit
685a3f16f5
13
autoenv.zsh
13
autoenv.zsh
@ -31,12 +31,7 @@ autoenv_source_parent() {
|
|||||||
if [[ -n $parent_env_file ]] \
|
if [[ -n $parent_env_file ]] \
|
||||||
&& _autoenv_check_authorized_env_file $parent_env_file; then
|
&& _autoenv_check_authorized_env_file $parent_env_file; then
|
||||||
_autoenv_debug "Calling autoenv_source_parent: parent_env_file:$parent_env_file"
|
_autoenv_debug "Calling autoenv_source_parent: parent_env_file:$parent_env_file"
|
||||||
|
_autoenv_source $parent_env_file enter
|
||||||
local parent_env_dir=${parent_env_file:A:h}
|
|
||||||
|
|
||||||
_autoenv_stack_entered_add $parent_env_file
|
|
||||||
|
|
||||||
_autoenv_source $parent_env_file enter $parent_env_dir
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,6 +230,10 @@ _autoenv_source() {
|
|||||||
_autoenv_debug "== END SOURCE =="
|
_autoenv_debug "== END SOURCE =="
|
||||||
builtin cd -q $new_dir
|
builtin cd -q $new_dir
|
||||||
|
|
||||||
|
if [[ $autoenv_event == enter ]]; then
|
||||||
|
_autoenv_stack_entered_add $env_file
|
||||||
|
fi
|
||||||
|
|
||||||
# Unset vars set for enter/leave scripts.
|
# Unset vars set for enter/leave scripts.
|
||||||
# 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.
|
||||||
@ -313,8 +312,6 @@ _autoenv_chpwd_handler() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_autoenv_stack_entered_add $env_file
|
|
||||||
|
|
||||||
# Source the enter env file.
|
# Source the enter env file.
|
||||||
_autoenv_debug "Sourcing from chpwd handler: $env_file"
|
_autoenv_debug "Sourcing from chpwd handler: $env_file"
|
||||||
_autoenv_source $env_file enter
|
_autoenv_source $env_file enter
|
||||||
|
Loading…
Reference in New Issue
Block a user