Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: _a2ps update
- X-seq: zsh-workers 18956
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxxxxx>
- Subject: PATCH: _a2ps update
- Date: Thu, 21 Aug 2003 14:41:03 +0200
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
It was bothering me that the languages (style sheets) weren't being
completed. This is still far from perfect.
The _arguments --help parsing stuff seems to have a few problems. If I
added a description for options it picked up, they are matched twice.
It would probably be better if that functionality was extracted out
from _arguments and done by a separate wrapper function. Might also
free up `--' to be used to separate options from option specifications.
Oliver
Index: Completion/Unix/Command/_a2ps
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_a2ps,v
retrieving revision 1.1
diff -u -r1.1 _a2ps
--- Completion/Unix/Command/_a2ps 2 Apr 2001 11:44:39 -0000 1.1
+++ Completion/Unix/Command/_a2ps 21 Aug 2003 12:20:18 -0000
@@ -2,38 +2,52 @@
# This is for the GNU version of a2ps.
-if [[ "$words[1]" != "$_a2ps_cache_cmd" ]]; then
+if [[ "$words[1]" != "$_cache_a2ps_cmd" ]]; then
local descr
- _a2ps_cache_cmd="$words[1]"
+ _cache_a2ps_cmd="$words[1]"
descr=( "${(@)${(f@)$(_call_program features LC_ALL=C $words[1] --list=features)//
/ }:#}" )
- _a2ps_cache_values=(
- "${descr[(r)Known [Ss]tyle [Ss]heets*]#* }"
- "${descr[(r)Known [Ee]ncodings*]#* }"
- "${descr[(r)Known [Mm]edia*]#* }"
- "${descr[(r)Known [Pp]rologues*]#* }"
- "${descr[(r)Known PostScript Printer Descriptions*]#* }"
- "${descr[(r)Known [Oo]utput [Dd]estination*]#* }"
- "${descr[(r)Known [Uu]ser [Oo]ptions*]#* }"
- "${descr[(r)Known Variables*]#* }"
+ _cache_a2ps_values=(
+ "${descr[(r)Known [Ss]tyle [Ss]heets*]#* }"
+ "${descr[(r)Known [Ee]ncodings*]#* }"
+ "${descr[(r)Known [Mm]edia*]#* }"
+ "${descr[(r)Known [Pp]rologues*]#* }"
+ "${descr[(r)Known PostScript Printer Descriptions*]#* }"
+ "${descr[(r)Known [Oo]utputs*]#* }"
+ "${descr[(r)Known [Uu]ser [Oo]ptions*]#* }"
+ "${descr[(r)Known Variables*]#* }"
)
fi
-_arguments '*:input file:_files' -- \
- '*\*:toggle:(yes no)' \
- '*=DIRECTION:direction:(rows columns)' \
- '*=TYPE:type:(r n nr rn any)' \
- '--highlight-level*:highlight:(none normal heavy)' \
- '--version-control*:version control:(none off t numbered nil
- existing never simple)' \
- "--pretty-print*::style:(${_a2ps_cache_values[1]})" \
- "--encoding*:encoding:(${_a2ps_cache_values[2]})" \
- "--medium*::medium:(${_a2ps_cache_values[3]})" \
- "--prologue*::prologue:(${_a2ps_cache_values[4]})" \
- "--ppd*::printer description:(${_a2ps_cache_values[5]})" \
- "--printer*::printer:(${_a2ps_cache_values[6]})" \
- "--user-option*::user option:(${_a2ps_cache_values[7]})" \
- "--variable*::variable:(${_a2ps_cache_values[8]})"
+_arguments \
+ '(-E --pretty-print=)'{-E-,--pretty-print=}"[enable pretty-printing]::language:(${_cache_a2ps_values[1]})" \
+ \*{-D+,--define=}"[set or unset variable]:variable:(${_cache_a2ps_values[8]})" \
+ '(-d -P --printer)'{-P,--printer=}"[send output to printer]:printer:(${_cache_a2ps_values[6]})" \
+ '(-A --file-align)'{-A,--file-align=}'[specify alignment of separate files]:mode:(virtual rank page sheet)' \
+ '(-a --pages)'{-a-,--pages=}'[select pages to print]:page range' \
+ '(-q --quiet --silent -v --verbose)'{-q,--quiet,--silent}'[quiet output]' \
+ '(-q --quiet --silent -v --verbose)'{-v-,--verbose=}'[verbose output]:level' \
+ '(-b --header)'{-b-,--header=}'[set the page header]:text' \
+ '(-g)--highlight-level=:highlight:(none normal heavy)' \
+ '--list=:topic:(features delegations encodings media prologues printers style-sheets user-options variables)' \
+ "--user-option=:user option:(${_cache_a2ps_values[7]})" \
+ {-M,--medium=}":medium:(${_cache_a2ps_values[3]})" \
+ "--ppd=::printer description:(${_cache_a2ps_values[5]})" \
+ '--statusdict=:statusdict definition' \
+ '--setpagedevice=:page device definition' \
+ '--margin=:margin size (PostScript points)' \
+ '--toc=:format' \
+ --{{center,left,right}-title.underlay,{,left-,right-}footer}'=:text' \
+ '*:input file:_files' -- \
+ '*\*:toggle:(yes no)' \
+ '*=DIRECTION:direction:(rows columns)' \
+ '*=TYPE:type:((r\:CR mac\:CR unix\:LF n\:LF nr\:LFCR rn\:CRLF pc\:CRLF any auto))' \
+ '--version-control*:version control:(none off t numbered nil existing never simple)' \
+ '--strip-level*:strip level:((0\:everything\ is\ printed 1\:regular\ comments\ are\ not\ printed 2\:strong\ comments\ are\ not\ printed 3\:no\ comment\ is\ printed))' \
+ '--sides=*:mode:(simplex duplex tumble)' \
+ '--non-printable-format*:format:(caret space question-mark octal hexa emacs)' \
+ "--encoding*:encoding:(${_cache_a2ps_values[2]})" \
+ "--prologue*::prologue:(${_cache_a2ps_values[4]})"
Messages sorted by:
Reverse Date,
Date,
Thread,
Author