From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15525 invoked from network); 27 Mar 2006 16:31:37 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.1 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 27 Mar 2006 16:31:37 -0000 Received: (qmail 2557 invoked from network); 27 Mar 2006 16:31:27 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 27 Mar 2006 16:31:27 -0000 Received: (qmail 2724 invoked by alias); 27 Mar 2006 16:31:19 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10096 Received: (qmail 2714 invoked from network); 27 Mar 2006 16:31:18 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 27 Mar 2006 16:31:18 -0000 Received: (qmail 1510 invoked from network); 27 Mar 2006 16:31:18 -0000 Received: from lila.akte.de (213.239.211.75) by a.mx.sunsite.dk with SMTP; 27 Mar 2006 16:31:17 -0000 Received: (root@lila.akte.de) by lila.akte.de id ; Mon, 27 Mar 2006 18:31:09 +0200 KRecCount: 1 KInfo: virscan ok KInfo: !spam auth Received: from condor.int.spiegl.de (p5497629D.dip.t-dialin.net [84.151.98.157]) by lila.akte.de via kasmail (2.9) id <1FNucM-85X-0-lila>; Mon, 27 Mar 2006 16:30:58 GMT Received: from condor.int.spiegl.de (spiegl@localhost [127.0.0.1]) by condor.int.spiegl.de (8.13.4/8.13.4/Debian-3sarge1) with ESMTP id k2RGUwH9002233 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Mon, 27 Mar 2006 18:30:58 +0200 Received: (from spiegl@localhost) by condor.int.spiegl.de (8.13.4/8.13.4/Submit) id k2RGUw9m002229 for zsh-users@sunsite.dk; Mon, 27 Mar 2006 18:30:58 +0200 X-Authentication-Warning: condor.int.spiegl.de: spiegl set sender to zsh.Andy@spiegl.de using -f Date: Mon, 27 Mar 2006 18:30:58 +0200 From: Andy Spiegl To: zsh-users@sunsite.dk Subject: Re: completion with descriptions Message-ID: <20060327163058.GA20833@spiegl.de> Mail-Followup-To: zsh-users@sunsite.dk References: <20060327132750.GB27668@spiegl.de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-PGP-GPG-Keys: mail -s "send pgp" auto@spiegl.de X-Fingerprint: Key-ID C2CB30F0: 9051 50B9 13B0 57B9 10FD 48AC 4FA1 209B C2CB 30F0 X-Accepted-File-Formats: ASCII OpenOffice .rtf .pdf - *NO* Microsoft files please. X-why-you-shouldnt-use-MS-LookOut: http://www.jensbenecke.de/l-oe-en.php X-warum-man-MS-Outlook-vermeiden-sollte: http://www.jensbenecke.de/l-oe-de.php X-how-to-quote: http://learn.to/quote/ X-how-to-ask-questions: http://www.catb.org/~esr/faqs/smart-questions.html X-stupid-disclaimers: http://goldmark.org/jeff/stupid-disclaimers/ User-Agent: Mutt/1.5.9i Thank you for the example, Peter! I tried to dig in deeply into writing completion functions now. :-) I took _aptitude as a template and came up with the following (see below) which works as wanted except for the fact that zsh inserts the _whole_ line (command + description) instead of just the command. *sigh* Like so: condor:~>gigaset del\ \ \ \ \ \ \ \ \ --\ Aufnahme\ löschen gigaset commands del -- Aufnahme löschen demux -- Aufnahme mit projectX demultiplexen details -- Details anzeigen dir -- Liste der Aufnahmen dump -- Details anzeigen mux -- Video+Audio(s) wieder zu einer MPG-Datei multiplexen title -- Kurzübersicht (Aufnahme-Titel in nur 1 Zeile) Can someone see where my error is, please? Here are the relevant parts of the function: (the whole thing is also here: http://andy.spiegl.de/software/_gigaset) [...] _arguments -S \ [...] '--commands[Liste aller Kommandos]' \ '1: :->cmds' \ '*: :->args' case $state in cmds) cmds=( ${${(M)${(f)"$(gigaset --commands 2>/dev/null)"}:#* -- *}/(#b) (*[^ ]) #-- (*)/$match[1]:$match[2]:l}) _describe -t commands "gigaset commands" cmds && ret=0 ;; args) [...] ;; esac Thx, Andy. -- For every problem there is one solution which is simple, neat, and wrong. -- Henry L. Mencken