about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArvid Norlander <VorpalBlade@users.noreply.github.com>2022-05-14 17:40:28 +0200
committerDaniel Shahaf <d.s@daniel.shahaf.name>2022-05-20 21:50:50 +0000
commita54d70457934662318feac9fcc750d2691250f33 (patch)
tree1f7d31177866ca2f726e357d8500f06cca320f89
parent545c42cdac25b73134a9577e3c0efa36d76b4091 (diff)
downloadzsh-a54d70457934662318feac9fcc750d2691250f33.tar.gz
zsh-a54d70457934662318feac9fcc750d2691250f33.tar.xz
zsh-a54d70457934662318feac9fcc750d2691250f33.zip
github #91: _find (gnu/freebsd/darwin): Add some flags and syntaxes
* -exec and -execdir can take ; or + as an ending marker. Previously only ; was
  supported. This is part of POSIX for -exec (support for + for -ok is optional
  and none of the implementations I looked at seem to support that).

* Missing completion for -files0-from (GNU find 4.9.0 and later). This flag
  needs to go with the global flags at the beginning and load the paths from
  the given file instead of from the command line.

* Missing completion for the -newerXY family of flags (GNU find 4.3.3, also
  available in FreeBSD and MacOS at least).
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Command/_find12
2 files changed, 14 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 191c64818..98e3089d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-05-20  Arvid Norlander  <VorpalBlade@users.noreply.github.com>
+
+	* github #91: Completion/Unix/Command/_find: _find
+	(gnu/freebsd/darwin): Add some flags and syntaxes
+
 2022-05-14  Bart Schaefer  <schaefer@zsh.org>
 
 	* 50229: NEWS: Typo
diff --git a/Completion/Unix/Command/_find b/Completion/Unix/Command/_find
index 74111f92b..560b77f7e 100644
--- a/Completion/Unix/Command/_find
+++ b/Completion/Unix/Command/_find
@@ -37,6 +37,11 @@ case $variant in
     args+=(
       '*-Bmin:birth time (minutes)'
       '*-Bnewer:file to compare (birth time):_files'
+      '*-newer'{a,B,c,m}{a,B,c,m}'[if [aBcm\]time is newer than [aBcm\]time of given file]:reference file:_files'
+      '*-newerat[if access time is newer than given timestamp]:timestamp: '
+      '*-newerBt[if birth time is newer than given timestamp]:timestamp: '
+      '*-newerct[if creation time is newer than given timestamp]:timestamp: '
+      '*-newermt[if modification time is newer than given timestamp]:timestamp: '
       '*-Btime:birth time (hours)'
     )
   ;|
@@ -46,7 +51,7 @@ case $variant in
       '*-anewer:file to compare (access time):_files'
       '*-cnewer:file to compare (inode change time):_files'
       '*-empty'
-      '*-execdir:program: _command_names -e:*\;::program arguments: _normal'
+      '*-execdir:program: _command_names -e:*(\;|+)::program arguments: _normal'
       '*-maxdepth:maximum search depth'
       '*-mindepth:minimum search depth'
       '*-path:path pattern to search:'
@@ -110,6 +115,7 @@ case $variant in
       '*-readable'
       '*-writable'
       '*-xtype:file type:((b\:block\ special\ file c\:character\ special\ file d\:directory p\:named\ pipe f\:normal\ file l\:symbolic\ link s\:socket))'
+      '-files0-from[start recursing from targets in given file]:NUL-separated targets file:_files'
       '*-fls:output file:_files'
       '*-fprint:output file:_files'
       '*-fprint0:output file:_files'
@@ -126,7 +132,7 @@ _arguments -C $args \
   '*-atime:access time (days):->times' \
   '*-ctime:inode change time (days):->times' \
   '*-depth' \
-  '*-exec:program: _command_names -e:*\;::program arguments: _normal' \
+  '*-exec:program: _command_names -e:*(\;|+)::program arguments: _normal' \
   '*-follow' \
   '*-fstype:file system type:_file_systems' \
   '*-group:group:_groups' \
@@ -147,7 +153,7 @@ _arguments -C $args \
   '*-user:user:_users' \
   '*-xdev' \
   '*-a' '*-o' \
-  '(-D -E -H -L -O -P -f -s -x --help --version)*:directory:_files -/' \
+  '(-D -E -H -L -O -P -f -s -x --files0-from --help --version)*:directory:_files -/' \
 && ret=0
 
 if [[ $state = times ]]; then