-
Notifications
You must be signed in to change notification settings - Fork 0
/
_f.sh
58 lines (53 loc) · 2.51 KB
/
_f.sh
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#compdef f.sh
local curcontext="$curcontext" state_descr variant default ret=1
local -a state line args alts disp smatch
#~ _pick_variant -r variant gnu=GNU $OSTYPE -version
_arguments -C \
'*:directory:_files -/' \
'*-L[follow symlinks]' \
'*-D[-depth : reverse to files first then their parent directory]' \
'*-d[-mindepth to -maxdepth : minimum to maximum search depth]' \
'*-I[-prune : skipped directory]: :_files -/' \
'(*-p *-P)'{-p,-P}'[-path : path pattern to search]: :_files -/' \
'*-z[-empty : empty files and directories]' \
'(*-k *-K)'{-k,-K}'[-type : file type]:file type:((b\:block\ special\ file c\:character\ special\ file d\:directory p\:named\ pipe f\:normal\ file l\:symbolic\ link s\:socket))' \
'(*-s *-S)'{-s,-S}'[-size]:size type:(b k M G + -)' \
'(*-o *-O)'{-o,-O}'[-perm]: :_file_modes' \
'(*-g *-G)'{-g,-G}'[-group]:group:_groups' \
'(*-u *-U)'{-u,-U}'[-user]:user:_users' \
'*-a[-daystart]' \
'(*-m *-M)'{-m,-M}'[-cmin : inode change time (minutes)]: :_dates -f m' \
'(*-t *-T)'{-t,-T}'[-ctime : inode change time (days)]: :->times' \
'(*-j *-J)'{-j,-J}'[-cnewer : file to compare (modification time)]: :_files' \
'(*-y *-Y)'{-y,-Y}'[-newerct : compare modification time than YYYY-MM-DD HH:MM]: :_dates' \
'*-e[-regextype]:regexp syntax:(help findutils-default awk egrep ed emacs gnu-awk grep posix-awk posix-basic posix-egrep posix-extended posix-minimal-basic sed)' \
'(*-r *-R)'{-r,-R}'[-regex : regular expression to search]' \
'(*-n *-N)'{-n,-N}'[-iname : name pattern (case insensitive)]' \
'*-f[-printf : show output with format]:output format' \
'*-W[-fprint : output file]:output file:_files' \
'*-F[-fprintf : output file with format]:output file:_files:output format' \
'*-0[-print0]' \
'*-l[-ls]' \
'*-q[show find commands]' \
'*-x[run]:execute command:((-e\:exec -o\:ok -ed\:execdir -od\:okdir))' \
'*-X[-delete]' \
&& ret=0
case $state in
times )
if ! compset -P '[+-]' || [[ -prefix '[0-9]' ]]; then
compstate[list]+=' packed'
if zstyle -t ":completion:${curcontext}:senses" verbose; then
zstyle -s ":completion:${curcontext}:senses" list-separator sep || sep=--
default=" [default exactly]"
disp=( "+ $sep before (older files)" "- $sep since (newer files)" )
smatch=( - + )
else
disp=( before exactly since )
smatch=( + '' - )
fi
alts=( "senses:sense${default}:compadd -V times -S '' -d disp -a smatch" )
fi
alts+=( "times:${state_descr}:_dates -f d" )
_alternative $alts && ret=0 ;;
esac
return ret