From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27142 invoked from network); 5 Jan 2000 14:56:52 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 5 Jan 2000 14:56:52 -0000 Received: (qmail 11767 invoked by alias); 5 Jan 2000 14:56:13 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9217 Received: (qmail 11753 invoked from network); 5 Jan 2000 14:56:12 -0000 Date: Wed, 5 Jan 2000 15:56:11 +0100 (MET) Message-Id: <200001051456.PAA11037@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Sven Wischnowsky's message of Wed, 5 Jan 2000 14:42:54 +0100 (MET) Subject: Re: help with command completion 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