From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24680 invoked from network); 19 Sep 2003 13:01:23 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 19 Sep 2003 13:01:23 -0000 Received: (qmail 10899 invoked by alias); 19 Sep 2003 13:00:57 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6604 Received: (qmail 10887 invoked from network); 19 Sep 2003 13:00:56 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 19 Sep 2003 13:00:56 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [193.109.254.211] by sunsite.dk (MessageWall 1.0.8) with SMTP; 19 Sep 2003 13:0:56 -0000 X-VirusChecked: Checked X-Env-Sender: okiddle@yahoo.co.uk X-Msg-Ref: server-14.tower-36.messagelabs.com!1063976455!653197 X-StarScan-Version: 5.0.7; banners=-,-,- Received: (qmail 31606 invoked from network); 19 Sep 2003 13:00:55 -0000 Received: from iris.logica.co.uk (158.234.9.163) by server-14.tower-36.messagelabs.com with SMTP; 19 Sep 2003 13:00:55 -0000 Received: from gmcs3.local ([158.234.142.61]) by iris.logica.co.uk (8.12.3/8.12.3/Debian -4) with ESMTP id h8JD0sgj002489; Fri, 19 Sep 2003 14:00:54 +0100 Received: from gmcs3.local (localhost [127.0.0.1]) by gmcs3.local (8.11.6/8.11.6/SuSE Linux 0.5) with ESMTP id h8JD3Iq09840; Fri, 19 Sep 2003 15:03:18 +0200 cc: zsh-users@sunsite.dk X-VirusChecked: Checked X-StarScan-Version: 5.0.7; banners=.,-,- In-reply-to: <200309181908.01862.malte.starostik@t-online.de> From: Oliver Kiddle References: <200309181908.01862.malte.starostik@t-online.de> To: Malte Starostik Subject: Re: Completing possible elements of a comma-separated list Date: Fri, 19 Sep 2003 15:03:18 +0200 Message-ID: <9838.1063976598@gmcs3.local> Malte Starostik wrote: > > I'm trying to write a completion for slptool. One of its commands is > slptool findattrs [attr ids] > Now I'd like to continue completion with the same list of possible matches, > completing any id in the comma separated list independently of each other > against the list of available ids. Easiest way is probably to use: _values -s , 'attribute id' $(slptool findattrs ...) Otherwise, you can use: local -a suf compset -P '*,' compset -S ',*' || suf=( -S , ) compadd ... "$suf[@]" ... That'll make it ignore anything before the cursor up the last comma (and the same in reverse for after the cursor). > Also, would be nice if > slptool findattrs example.acme u,p > could complete to > slptool findattrs example.acme username,password, > as well. That's harder. _sep_parts or _multi_parts might help you. Otherwise, you need to start using compadd -O and it gets complicated. Oliver