1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-01 07:31:20 +02:00

30021: _globquals: Add d flag, show what unit the digits are entered in.

This commit is contained in:
Mikael Magnusson 2011-12-14 01:11:20 +00:00
parent fd1c2364f4
commit 346c4c46cc
2 changed files with 14 additions and 8 deletions

View file

@ -5,6 +5,10 @@
* 30019: Completion/Unix/Command/_tar: fix parsing of argument * 30019: Completion/Unix/Command/_tar: fix parsing of argument
to -C. 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> 2011-12-13 Barton E. Schaefer <schaefer@zsh.org>
* 30020: Functions/Prompts/promptinit: prevent prompt_opts and * 30020: Functions/Prompts/promptinit: prevent prompt_opts and
@ -15753,5 +15757,5 @@
***************************************************** *****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL * This is used by the shell to define $ZSH_PATCHLEVEL
* $Revision: 1.5540 $ * $Revision: 1.5541 $
***************************************************** *****************************************************

View file

@ -1,7 +1,8 @@
#autoload #autoload
local state=qual expl char delim local state=qual expl char delim timespec
local -a alts local -a alts
local -A specmap
while [[ -n $PREFIX ]]; do while [[ -n $PREFIX ]]; do
char=$PREFIX[1] char=$PREFIX[1]
@ -111,18 +112,19 @@ while [[ -n $PREFIX ]]; do
;; ;;
([amc]) ([amc])
if ! compset -P '([Mwhms]|)([-+]|)<->'; then if ! compset -P '([Mwhmsd]|)([-+]|)<->'; then
# complete/skip relative time spec # complete/skip relative time spec
alts=() alts=()
if ! compset -P '[Mwhms]' && [[ -z $PREFIX ]]; then timespec=$PREFIX[1]
alts+=( if ! compset -P '[Mwhmsd]' && [[ -z $PREFIX ]]; then
"time-specifiers:time specifier:\ alts+=("time-specifiers:time specifier:\
((M\:months w\:weeks h\:hours m:\minutes s\:seconds))") ((M\:months w\:weeks h\:hours m:\minutes s\:seconds d\:days))")
fi fi
if ! compset -P '[-+]' && [[ -z $PREFIX ]]; then if ! compset -P '[-+]' && [[ -z $PREFIX ]]; then
alts+=("senses:sense:((-\:less\ than +\:more\ than))") alts+=("senses:sense:((-\:less\ than +\:more\ than))")
fi 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 _alternative $alts
return return
fi fi