summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2015-07-07 22:59:00 +0200
committerOliver Kiddle <opk@zsh.org>2015-07-07 22:59:00 +0200
commit396f68971fef574160e780c01d12a58747f5d224 (patch)
tree1ad9bdf79a4dddc8714cb9f222026aa930101e63 /Completion/Unix/Command
parent04675eca4ce9396d1efd0563b2b786f5bc6d66ed (diff)
downloadzsh-396f68971fef574160e780c01d12a58747f5d224.tar.gz
zsh-396f68971fef574160e780c01d12a58747f5d224.zip
35718: new calendar style date completion
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r--Completion/Unix/Command/_find21
1 files changed, 16 insertions, 5 deletions
diff --git a/Completion/Unix/Command/_find b/Completion/Unix/Command/_find
index 8f80e36cf..aefca34f2 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
@@ -114,11 +115,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' \
@@ -128,7 +129,7 @@ _arguments $args \
'*-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 +144,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