mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-05-20 06:56:05 +02:00
26801: add completion for calendar function
add tracking of precommand modifiers that are in effect
This commit is contained in:
parent
7df454402c
commit
1e7c14ee35
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,12 @@
|
|||
2009-04-01 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 26801: Completion/Base/Core/_main_complete,
|
||||
Completion/Unix/Command/_calendar,
|
||||
Completion/Zsh/Command/_command,
|
||||
Completion/Zsh/Command/_precommand: add completion for calendar
|
||||
function; add tracking for precommand modifiers that are
|
||||
in effect.
|
||||
|
||||
2009-03-26 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 26797: Doc/Zsh/options.yo: further minor changes.
|
||||
|
@ -11499,5 +11508,5 @@
|
|||
|
||||
*****************************************************
|
||||
* This is used by the shell to define $ZSH_PATCHLEVEL
|
||||
* $Revision: 1.4640 $
|
||||
* $Revision: 1.4641 $
|
||||
*****************************************************
|
||||
|
|
|
@ -32,6 +32,9 @@ local func funcs ret=1 tmp _compskip format nm call match min max i num\
|
|||
_saved_insert="${compstate[insert]}" \
|
||||
_saved_colors="$ZLS_COLORS"
|
||||
|
||||
# _precommand sets this to indicate we are following a precommand modifier
|
||||
local -a precommands
|
||||
|
||||
typeset -U _lastdescr _comp_ignore _comp_colors
|
||||
|
||||
[[ -z "$curcontext" ]] && curcontext=:::
|
||||
|
|
|
@ -1,12 +1,34 @@
|
|||
#compdef calendar
|
||||
|
||||
_arguments \
|
||||
'-a[process files of all users]' \
|
||||
'-A[print today and the following num days]:number of days:' \
|
||||
'-b[enforce special KOI8 date calculation mode]' \
|
||||
'-B[print today and the previous num days]:number of days:' \
|
||||
'-f[use file as the default calendar]:calendar file:_files' \
|
||||
'-l[print today and the following num days]:number of days:' \
|
||||
'-w[print today and the following num days only if today is Friday]:number of days:' \
|
||||
'-t[act as though today is the date specified]:date:'
|
||||
if [[ $+functions[calendar] -eq 1 && -z $precommands[(r)command] ]]; then
|
||||
# The shell function is loaded, and we're not instructed to
|
||||
# use an external command, so complete that.
|
||||
_arguments \
|
||||
'-a[show all calendar items]' \
|
||||
'-b[brief, display first line only]' \
|
||||
'-d[move events to done file]' \
|
||||
'-D[never move events to done file]' \
|
||||
'-r[show all remaining items from start or now]' \
|
||||
'-s[use sched to schedule a warning]' \
|
||||
'-v[verbose]' \
|
||||
'-B[select number of lines to display]:lines: ' \
|
||||
'-C[select calendar file]:calendar file:_path_files' \
|
||||
'-n[select max number of events]:max number of events: ' \
|
||||
'-S[select show programme]:show programme:_command_names' \
|
||||
'1:date/time: ' \
|
||||
'(-r)2:end date/time: '
|
||||
else
|
||||
# This is only one particular version of calendar.
|
||||
# Some variant of BSD, I think.
|
||||
|
||||
_arguments \
|
||||
'-a[process files of all users]' \
|
||||
'-A[print today and the following num days]:number of days:' \
|
||||
'-b[enforce special KOI8 date calculation mode]' \
|
||||
'-B[print today and the previous num days]:number of days:' \
|
||||
'-f[use file as the default calendar]:calendar file:_files' \
|
||||
'-l[print today and the following num days]:number of days:' \
|
||||
'-w[print today and the following num days only if today is Friday]:number of days:' \
|
||||
'-t[act as though today is the date specified]:date:'
|
||||
|
||||
fi
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
local ret
|
||||
|
||||
# indicate if this is a precommand modifier
|
||||
[[ $service = command ]] && precommands+=(command)
|
||||
if [[ CURRENT -ge 3 ]]; then
|
||||
compset -n 2
|
||||
_normal && ret=0
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#compdef - nohup eval time rusage noglob nocorrect exec catchsegv aoss
|
||||
|
||||
# precommands is made local in _main_complete
|
||||
precommands+=($words[1])
|
||||
|
||||
shift words
|
||||
(( CURRENT-- ))
|
||||
|
||||
|
|
Loading…
Reference in New Issue