summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command/_find
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix/Command/_find')
-rw-r--r--Completion/Unix/Command/_find43
1 files changed, 29 insertions, 14 deletions
diff --git a/Completion/Unix/Command/_find b/Completion/Unix/Command/_find
index 8f80e36cf..e736f32cb 100644
--- a/Completion/Unix/Command/_find
+++ b/Completion/Unix/Command/_find
@@ -1,6 +1,7 @@
#compdef find gfind
-local variant args
+local curcontext="$curcontext" state_descr variant
+local -a state line args alts
_pick_variant -r variant gnu=GNU $OSTYPE -version
@@ -26,12 +27,12 @@ case $variant in
'*-print0'
)
;|
+ solaris*|freebsd*|dragonfly*|darwin*|gnu)
+ args+=( '*-mount' )
+ ;|
netbsd*|freebsd*|dragonfly*|darwin*|gnu)
args+=( '(-H -L)-P[never follow symlinks]' )
;|
- netbsd*|freebsd*|dragonfly*|openbsd*|darwin*|gnu)
- args+=( '-d[depth first traversal]' )
- ;|
darwin*|freebsd*|gnu)
args+=(
'*-Bmin:birth time (minutes)'
@@ -39,11 +40,13 @@ case $variant in
'*-Btime:birth time (hours)'
)
;|
- freebsd*|dragonfly*|darwin*|openbsd*|gnu)
+ netbsd*|freebsd*|dragonfly*|openbsd*|darwin*|gnu)
args+=(
+ '-d[depth first traversal]'
'*-anewer:file to compare (access time):_files'
'*-cnewer:file to compare (inode change time):_files'
- '*-mnewer:file to compare (modification time):_files'
+ '*-empty'
+ '*-execdir:program: _command_names -e:*\;::program arguments: _normal'
'*-maxdepth:maximum search depth'
'*-mindepth:minimum search depth'
'*-path:path pattern to search:'
@@ -52,8 +55,6 @@ case $variant in
freebsd*|dragonfly*|darwin*|gnu)
args+=(
'*-delete'
- '*-empty'
- '*-execdir:program: _command_names -e:*\;::program arguments: _normal'
'*-gid:numeric group ID'
'*-uid:numeric user ID'
'*-noleaf'
@@ -65,6 +66,7 @@ case $variant in
'*-wholename:full path pattern to search' \
'*-iwholename:full path pattern to search (case insensitive)'
'*-ignore_readdir_race'
+ '*-mnewer:file to compare (modification time):_files'
'*-noignore_readdir_race'
'*-okdir:program: _command_names -e:*\;::program arguments: _normal'
'*-samefile:file to compare inode:_files' \
@@ -79,9 +81,13 @@ case $variant in
netbsd*|freebsd*|dragonfly*|darwin*)
args+=(
'-E[use extended regular expressions with -regex/-iregex]'
+ '-s[traverse directories in sorted order]'
+ )
+ ;|
+ netbsd*|freebsd*|dragonfly*|openbsd*|darwin*)
+ args+=(
'-X[warn if filename contains characters special to xargs]'
'-f[specify file hierarchy to traverse]:path:_directories'
- '-s[traverse directories in sorted order]'
"-x[don't span filesystems]"
'*-flags:flags:_chflags'
)
@@ -114,11 +120,11 @@ case $variant in
;;
esac
-_arguments $args \
+_arguments -C $args \
'(-L -P)-H[only follow symlinks when resolving command-line arguments]' \
'(-H -P)-L[follow symlinks]' \
- '*-atime:access time (days)' \
- '*-ctime:inode change time (days)' \
+ '*-atime:access time (days):->times' \
+ '*-ctime:inode change time (days):->times' \
'*-depth' \
'*-exec:program: _command_names -e:*\;::program arguments: _normal' \
'*-follow' \
@@ -127,8 +133,7 @@ _arguments $args \
'*-inum:inode number:' \
'*-links:number of links:' \
'*-ls' \
- '*-mount' \
- '*-mtime:modification time (days)' \
+ '*-mtime:modification time (days):->times' \
'*-name:name pattern' \
'*-newer:file to compare (modification time):_files' \
'*-nogroup' \
@@ -143,3 +148,13 @@ _arguments $args \
'*-xdev' \
'*-a' '*-o' \
'*:directory:_files -/'
+
+if [[ $state = times ]]; then
+ if ! compset -P '[+-]' || [[ -prefix '[0-9]' ]]; then
+ disp=( 'before' 'exactly' 'since' )
+ compstate[list]+=' packed'
+ alts=( "senses:sense:compadd -V times -S '' -d disp - + '' -" )
+ fi
+ alts+=( "times:${state_descr}:_dates -f d" )
+ _alternative $alts
+fi