zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: help with command completion
Date: Wed, 5 Jan 2000 15:56:11 +0100 (MET)	[thread overview]
Message-ID: <200001051456.PAA11037@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Sven Wischnowsky's message of Wed, 5 Jan 2000 14:42:54 +0100 (MET)


I wrote:

> [ This one moved to zsh-workers... ]

Ouch. But this time I really did that...

> Here is _lp for lpr, lp, lpq, and lprm. Could definitely be improved,
> but I don't know how (non-)standard the options supported by my lpr
> are.

I'm an idiot.

Bye
 Sven

diff -ru ../z.old/Completion/User/_lp Completion/User/_lp
--- ../z.old/Completion/User/_lp	Wed Jan  5 15:43:57 2000
+++ Completion/User/_lp	Wed Jan  5 15:53:36 2000
@@ -1,6 +1,6 @@
 #compdef lp lpr lpq lprm
 
-local file expl ret=1 list disp strs shown
+local file expl ret=1 printer list disp strs shown
 
 if (( ! $+_lp_cache )); then
    file=( /etc/(printcap|printers.conf)(N) )
@@ -18,7 +18,12 @@
   _wanted printers expl printer && compadd "$expl" - "$_lp_cache[@]"
 else
   if [[ "$words[1]" = (lpq|lprm) ]]; then
-    list=( "${(@M)${(f@)$(lpq)}:#[0-9]*}" )
+    if [[ "$words" = *-P* ]]; then
+      printer=(-P "${${words##*-P( |)}%% *}")
+    else
+      printer=()
+    fi
+    list=( ${(M)"${(f@)$(lpq $printer 2> /dev/null)}":#[0-9]*} )
 
     if (( $#list )); then
       _tags users jobs
diff -ru ../z.old/Doc/Zsh/compsys.yo Doc/Zsh/compsys.yo
--- ../z.old/Doc/Zsh/compsys.yo	Tue Jan  4 14:57:28 2000
+++ Doc/Zsh/compsys.yo	Wed Jan  5 15:45:11 2000
@@ -565,6 +565,9 @@
 item(tt(prefixes))(
 for prefixes (like those of an URL)
 )
+item(tt(printers))(
+for printer names
+)
 item(tt(processes))(
 for process identifiers
 )

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


             reply	other threads:[~2000-01-05 14:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-05 14:56 Sven Wischnowsky [this message]
     [not found] <200001051437.PAA10986@beta.informatik.hu-berlin.de>
2000-01-05 15:46 ` Oliver Kiddle
2000-01-05 16:42   ` Andrej Borsenkow
2000-01-05 17:07     ` Tanaka Akira
2000-01-05 15:55 Sven Wischnowsky
     [not found] <200001051342.OAA10929@beta.informatik.hu-berlin.de>
2000-01-05 23:52 ` Tanaka Akira
2000-01-06 10:56 Sven Wischnowsky
2000-01-06 11:22 ` Oliver Kiddle
2000-01-06 15:35 ` Tanaka Akira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200001051456.PAA11037@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).