]> Sergey Matveev's repositories - zsh-autoenv.git/blobdiff - autoenv.zsh
AUTOENV_DEBUG=3 sets xtrace while sourcing; doc (#65)
[zsh-autoenv.git] / autoenv.zsh
index e6cfc13f665cc412494732a2f3722ef56b464d59..db059f292e319a81f36296d9e7907f3c09d7c040 100644 (file)
@@ -303,7 +303,16 @@ _autoenv_source() {
   # Source the env file.
   _autoenv_debug "== SOURCE: ${bold_color:-}$autoenv_env_file${reset_color:-}\n      PWD: $PWD"
   : $(( _autoenv_debug_indent++ ))
+
+  local restore_xtrace
+  if [[ $AUTOENV_DEBUG -gt 2 && ! -o xtrace ]]; then
+    restore_xtrace=1
+    setopt localoptions xtrace
+  fi
   source $autoenv_env_file
+  if (( restore_xtrace )); then
+    setopt noxtrace
+  fi
   : $(( _autoenv_debug_indent-- ))
   _autoenv_debug "== END SOURCE =="