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

local func base=2

while [[ $words[base] = -* ]]; do
  case $words[base] in
    -d) delete=yes ;;
    -p) type=pattern ;;
    -k) type=key ;;
  esac  
  (( base++ ))
done

if [ "$delete" ]; then
  compadd ${(k)_comps}
else
  if [[ CURRENT -eq base  ]]; then
    for func in ${^~fpath:/.}/_(|*[^~])(N:t); compadd -P_ - ${func#_}
  else
    compgen -c
  fi
fi