summary refs log tree commit diff
path: root/Completion/Builtins/_zmodload
blob: fd476ca99f08f1db9505c0f3327efea2c26ed3d7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#compdef zmodload

local fl="$words[2]" expl ret=1

if [[ "$fl" = -*(a*u|u*a)* || "$fl" = -*a* && CURRENT -ge 4 ]]; then
  _wanted builtins expl 'builtin command' compadd "$@" -k builtins
elif [[ "$fl" = -*u* ]]; then
  _wanted modules expl module compadd -k modules
else
  _tags files aliases
  while _tags; do
    _requested files expl 'module file' \
      _files -W module_path -/g '*.(dll|s[ol])(:r)' && ret=0
    if _requested aliases expl 'module alias'; then
      local array
      array=(${${(f)"$(zmodload -A)"}%% *})
      (( $#array )) && compadd "${expl[@]}" -- $array && ret=0
    fi
    (( ret )) || break
  done
fi