zsh:autoload: Allow nested directories

As well as wrapper in subdirectories.
This commit is contained in:
2025-03-25 11:03:16 +01:00
parent cd54c3dfed
commit 2363545489

View File

@@ -10,17 +10,16 @@ autoload -Uz run-help run-help-git zmv
# Load autoloadable functions # Load autoloadable functions
if [[ -d "$ZDOTDIR/autoload" ]]; then if [[ -d "$ZDOTDIR/autoload" ]]; then
# Include all wrapper scripts if their wrapped command exists # Include all wrapper scripts if their wrapped command exists
d="$ZDOTDIR/autoload/wrapper" for d in "$ZDOTDIR/autoload/"**/wrapper(/N); do
if [[ -d "$d" ]]; then
fpath=("$d" $fpath) fpath=("$d" $fpath)
for f in "$d"/[^_.]*(.xN:t); do for f in "$d"/[^_.]*(.xN:t); do
(( $+commands[$f] )) || continue (( $+commands[$f] )) || continue
autoload -Uz -- "$f" autoload -Uz -- "$f"
done done
fi done
# Include all other subdirectories # Include all other subdirectories
for d in "$ZDOTDIR/autoload/"*(/N); do for d in "$ZDOTDIR/autoload/"**(/N); do
# EXTENDED_GLOB is not yet set, so we have to exclude manually # EXTENDED_GLOB is not yet set, so we have to exclude manually
[[ ${d:t} != wrapper ]] || continue [[ ${d:t} != wrapper ]] || continue