From: Mikael Magnusson <mikachu@gmail.com>
To: zsh-workers@zsh.org
Subject: PATCH: _globquals: Say what the digit is when completing modification time qualifiers
Date: Sat, 10 Dec 2011 21:02:37 +0100 [thread overview]
Message-ID: <1323547357-12444-1-git-send-email-mikachu@gmail.com> (raw)
In-Reply-To: <20111210192647.21ca03f6@pws-pc.ntlworld.com>
How about something like this too? It changes the completion output to
say what the digit means.
% *(m<tab>
=== time specifier
M -- months
h -- hours
m -- minutes
s -- seconds
w -- weeks
=== sense
+ -- more than
- -- less than
=== digit (days)
% *(mM<tab>
=== digit (months)
---
Completion/Zsh/Type/_globquals | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/Completion/Zsh/Type/_globquals b/Completion/Zsh/Type/_globquals
index 778dfa8..b47a34d 100644
--- a/Completion/Zsh/Type/_globquals
+++ b/Completion/Zsh/Type/_globquals
@@ -114,6 +114,10 @@ while [[ -n $PREFIX ]]; do
if ! compset -P '([Mwhms]|)([-+]|)<->'; then
# complete/skip relative time spec
alts=()
+ () {
+ local timespec=$PREFIX[1]
+ local -A specmap
+ specmap=( M months w weeks h hours m minutes s seconds '' days )
if ! compset -P '[Mwhms]' && [[ -z $PREFIX ]]; then
alts+=(
"time-specifiers:time specifier:\
@@ -122,7 +126,8 @@ while [[ -n $PREFIX ]]; do
if ! compset -P '[-+]' && [[ -z $PREFIX ]]; then
alts+=("senses:sense:((-\:less\ than +\:more\ than))")
fi
- alts+=('digits:digit: ')
+ alts+=('digits:digit ('${${specmap[$timespec]}:-invalid time specifier}'): ')
+ }
_alternative $alts
return
fi
--
1.7.5.4
next prev parent reply other threads:[~2011-12-10 20:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-10 17:09 Documentation error gi1242+zsh
2011-12-10 17:37 ` Mikael Magnusson
2011-12-10 17:44 ` gi1242+zsh
2011-12-10 18:29 ` Peter Stephenson
2011-12-10 18:54 ` Mikael Magnusson
2011-12-10 19:26 ` Peter Stephenson
2011-12-10 20:02 ` Mikael Magnusson [this message]
2011-12-13 19:23 ` PATCH: _globquals: Say what the digit is when completing time qualifiers, add d Mikael Magnusson
2011-12-13 21:27 ` Peter Stephenson
2011-12-10 20:13 ` Documentation error Peter Stephenson
2011-12-11 2:22 ` gi1242+zsh
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=1323547357-12444-1-git-send-email-mikachu@gmail.com \
--to=mikachu@gmail.com \
--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).