+ # Unset vars set for enter/leave scripts.
+ # This should not get done for recursion (via autoenv_source_parent),
+ # and can be useful to have in general after autoenv was used.
+ # unset _autoenv_event _autoenv_from_dir _autoenv_to_dir
+}
+
+_autoenv_get_file_upwards() {
+ local look_from=${1:-$PWD}
+ local look_for=${2:-$AUTOENV_FILE_ENTER}
+ # Look for files in parent dirs, using an extended Zsh glob.
+ setopt localoptions extendedglob
+ local m
+ # Y1: short-circuit: first match.
+ # :A: absolute path, resolving symlinks.
+ m=($look_from/(../)##${look_for}(NY1:A))
+ if (( $#m )); then
+ echo $m[1]
+ fi