Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: _a2ps printers



a2ps understands system printers in addition to the ones specifically
configured into it.  I suspect most of us with pre-packaged a2ps's are
relying on the former.

It didn't seem worth using _alternative or anything more complicated,
feel free to change.

Index: Completion/Unix/Command/_a2ps
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_a2ps,v
retrieving revision 1.2
diff -u -r1.2 _a2ps
--- Completion/Unix/Command/_a2ps	21 Aug 2003 12:55:35 -0000	1.2
+++ Completion/Unix/Command/_a2ps	1 Mar 2005 11:53:08 -0000
@@ -22,10 +22,14 @@
   )
 fi
 
+integer ret=1
+local context state line expl
+typeset -A opt_args
+
 _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]})" \
+  '(-d -P --printer)'{-P,--printer=}"[send output to printer]:printer:->printers" \
   '(-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]' \
@@ -50,4 +54,11 @@
   '--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]})"
+  "--prologue*::prologue:(${_cache_a2ps_values[4]})" && ret=0
+
+if [[ $state = printers ]]; then
+  _wanted printers expl printer compadd -- ${=_cache_a2ps_values[6]} && ret=0
+  _printers && ret=0
+fi
+
+return ret

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

**********************************************************************



Messages sorted by: Reverse Date, Date, Thread, Author