about summary refs log tree commit diff
path: root/Completion/User/_find
blob: 3ccb14c32edfcdd39d5c00a3fe4eaee1cb87078e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#compdef find

local prev="$words[CURRENT-1]" expl

if compset -N '-(ok|exec)' '\;'; then
  _normal
elif [[ "$PREFIX" = -* ]]; then
  _description expl option
  compadd "$expl[@]" - -daystart -{max,min,}depth -follow -noleaf \
    -version -xdev -{a,c,}newer -{a,c,m}{min,time} -empty -false \
    -{fs,x,}type -gid -inum -links -{i,}{l,}name -{no,}{user,group} \
    -path -perm -regex -size -true -uid -used -exec -{f,}print{f,0,} \
    -ok -prune -ls
elif [[ CURRENT -eq 2 ]]; then
  local ret=1

  _description expl directory
  compgen "$expl[@]" -g '. ..' && ret=0
  _files -/ && ret=0

  return ret
elif [[ "$prev" = -((a|c|)newer|fprint(|0|f)) ]]; then
  _files
elif [[ "$prev" = -fstype ]]; then
  _description expl 'file system type'
  compadd "$expl[@]" ufs 4.2 4.3 nfs tmp mfs S51K S52K
elif [[ "$prev" = -group ]]; then
  _groups
elif [[ "$prev" = -user ]]; then
  _users
fi