zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <opk@zsh.org>
To: Zsh workers <zsh-workers@zsh.org>
Subject: PATCH: meaning of before/since for date glob qualifiers completion
Date: Tue, 14 Dec 2021 18:35:09 +0100	[thread overview]
Message-ID: <81797-1639503309.634798@2hZQ.8n-8.PNRX> (raw)

This is a variant of the github #80 from Vincent Bernat.

Descriptions of just "before" and "since" are perhaps ambiguous because
it can depend on your perspective as to whether the specified date is
before/since the file time-stamp or the other way around. For
completion, we tend to be focussed on the value entered but in actual
usage the age of the files is perhaps foremost in people's mind.

This inverts them as per the github PR but also adds a brief
parenthetical. I'd prefer to keep the descriptions as brief as possible
because _dates expects most of the terminal is available to it.

Oliver

diff --git a/Completion/Unix/Command/_find b/Completion/Unix/Command/_find
index 8ff60baf2..74111f92b 100644
--- a/Completion/Unix/Command/_find
+++ b/Completion/Unix/Command/_find
@@ -156,11 +156,11 @@ if [[ $state = times ]]; then
     if zstyle -t ":completion:${curcontext}:senses" verbose; then
       zstyle -s ":completion:${curcontext}:senses" list-separator sep || sep=--
       default=" [default exactly]"
-      disp=( "- $sep before" "+ $sep since" )
+      disp=( "+ $sep before (older files)" "- $sep since (newer files)" )
       smatch=( - + )
     else
       disp=( before exactly since )
-      smatch=( - '' + )
+      smatch=( + '' - )
     fi
     alts=( "senses:sense${default}:compadd -V times -S '' -d disp -a smatch" )
   fi
diff --git a/Completion/Zsh/Type/_globquals b/Completion/Zsh/Type/_globquals
index 915f97c1c..bc3165eba 100644
--- a/Completion/Zsh/Type/_globquals
+++ b/Completion/Zsh/Type/_globquals
@@ -127,16 +127,14 @@ while [[ -n $PREFIX ]]; do
 	alts+=( "time-specifiers:time specifier:compadd -E 0 -d tdisp -S '' -a tmatch" )
       fi
       if ! compset -P '[-+]' && [[ -z $PREFIX ]]; then
-	sdisp=( before exactly since )
-	smatch=( - '' + )
 	if zstyle -t ":completion:${curcontext}:senses" verbose; then
 	  zstyle -s ":completion:${curcontext}:senses" list-separator sep || sep=--
 	  default=" [default exactly]"
-	  sdisp=( "- $sep before" "+ $sep since" )
-	  smatch=( - + )
+          sdisp=( "+ $sep before (older files)" "- $sep since (newer files)" )
+	  smatch=( + - )
 	else
 	  sdisp=( before exactly since )
-	  smatch=( - '' + )
+	  smatch=( + '' - )
 	fi
         alts+=( "senses:sense${default}:compadd -E 0 -d sdisp -S '' -a smatch" )
       fi


                 reply	other threads:[~2021-12-14 17:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=81797-1639503309.634798@2hZQ.8n-8.PNRX \
    --to=opk@zsh.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).