1
0
mirror of https://github.com/Tarrasch/zsh-autoenv.git synced 2024-12-01 18:31:00 +02:00

Add support for $AUTOENV_DISABLED, which skips the chpwd hook

This commit is contained in:
Daniel Hahler 2015-01-19 19:01:20 +01:00
parent 7a0a67a982
commit 9875081ef7

View File

@ -267,10 +267,16 @@ _autoenv_get_file_upwards() {
_autoenv_chpwd_prev_dir=$PWD _autoenv_chpwd_prev_dir=$PWD
_autoenv_chpwd_handler() { _autoenv_chpwd_handler() {
local env_file="$PWD/$AUTOENV_FILE_ENTER"
_autoenv_debug "Calling chpwd handler: PWD=$PWD" _autoenv_debug "Calling chpwd handler: PWD=$PWD"
if (( $AUTOENV_DISABLED )); then
_autoenv_debug "Disabled (AUTOENV_DISABLED)."
return
fi
local env_file="$PWD/$AUTOENV_FILE_ENTER"
_autoenv_debug "env_file: $env_file"
# Handle leave event for previously sourced env files. # Handle leave event for previously sourced env files.
if [[ $AUTOENV_HANDLE_LEAVE == 1 ]] && (( $#_autoenv_stack_entered )); then if [[ $AUTOENV_HANDLE_LEAVE == 1 ]] && (( $#_autoenv_stack_entered )); then
local prev_file prev_dir local prev_file prev_dir