summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2011-12-14 01:11:20 +0000
committerMikael Magnusson <mikachu@gmail.com>2011-12-14 01:11:20 +0000
commit346c4c46cc976a38206f3933029675e209b249eb (patch)
treeae7beb0bcce387d4ee4ef4287ab1581a886249bf
parentfd1c2364f42993c327f10b8a1b3ce205de06e501 (diff)
downloadzsh-346c4c46cc976a38206f3933029675e209b249eb.tar.gz
zsh-346c4c46cc976a38206f3933029675e209b249eb.zip
30021: _globquals: Add d flag, show what unit the digits are entered in.
-rw-r--r--ChangeLog6
-rw-r--r--Completion/Zsh/Type/_globquals16
2 files changed, 14 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index d434032fe..5fe7a0e22 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,10 @@
* 30019: Completion/Unix/Command/_tar: fix parsing of argument
to -C.
+ * 30021: Completion/Zsh/Type/_globquals: Add d flag (see 29991),
+ show what unit the digits are entered in as a hint that the
+ default is also days.
+
2011-12-13 Barton E. Schaefer <schaefer@zsh.org>
* 30020: Functions/Prompts/promptinit: prevent prompt_opts and
@@ -15753,5 +15757,5 @@
*****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5540 $
+* $Revision: 1.5541 $
*****************************************************
diff --git a/Completion/Zsh/Type/_globquals b/Completion/Zsh/Type/_globquals
index 778dfa822..9de7742ff 100644
--- a/Completion/Zsh/Type/_globquals
+++ b/Completion/Zsh/Type/_globquals
@@ -1,7 +1,8 @@
#autoload
-local state=qual expl char delim
+local state=qual expl char delim timespec
local -a alts
+local -A specmap
while [[ -n $PREFIX ]]; do
char=$PREFIX[1]
@@ -111,18 +112,19 @@ while [[ -n $PREFIX ]]; do
;;
([amc])
- if ! compset -P '([Mwhms]|)([-+]|)<->'; then
+ if ! compset -P '([Mwhmsd]|)([-+]|)<->'; then
# complete/skip relative time spec
alts=()
- if ! compset -P '[Mwhms]' && [[ -z $PREFIX ]]; then
- alts+=(
- "time-specifiers:time specifier:\
-((M\:months w\:weeks h\:hours m:\minutes s\:seconds))")
+ timespec=$PREFIX[1]
+ if ! compset -P '[Mwhmsd]' && [[ -z $PREFIX ]]; then
+ alts+=("time-specifiers:time specifier:\
+((M\:months w\:weeks h\:hours m:\minutes s\:seconds d\:days))")
fi
if ! compset -P '[-+]' && [[ -z $PREFIX ]]; then
alts+=("senses:sense:((-\:less\ than +\:more\ than))")
fi
- alts+=('digits:digit: ')
+ specmap=( M months w weeks h hours m minutes s seconds '(|+|-|d)' days)
+ alts+=('digits:digit ('${${specmap[(K)$timespec]}:-invalid time specifier}'):' )
_alternative $alts
return
fi