Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: _globquals: Say what the digit is when completing modification time qualifiers
- X-seq: zsh-workers 29990
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: PATCH: _globquals: Say what the digit is when completing modification time qualifiers
- Date: Sat, 10 Dec 2011 21:02:37 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:x-mailer:in-reply-to:references; bh=euK3Ln+n5WDC7k9aPFmItL91slrJfVwXZ1UxvYtJAJI=; b=OYL/YTZXhnttRccrXG2nVU+qOfyVbsz3mMSH37wa8pw+ORxT7WgQgwCNj8j/aTkJGK lLIEdANrUiZuipaI7IoVfUwwySiE2sUlGQKJevIbmjmlJ2+94wdbpazoj6m5n4xNNYLL vpQo/32KWWT3NkXJIdbmoXdTr+Fho7F1i8W34=
- In-reply-to: <20111210192647.21ca03f6@pws-pc.ntlworld.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author