From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11208 invoked from network); 25 Feb 2002 08:56:01 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 25 Feb 2002 08:56:01 -0000 Received: (qmail 732 invoked by alias); 25 Feb 2002 08:55:46 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 4688 Received: (qmail 721 invoked from network); 25 Feb 2002 08:55:46 -0000 From: Sven Wischnowsky MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15481.64476.314684.446454@wischnow.berkom.de> Date: Mon, 25 Feb 2002 09:54:52 +0100 To: zsh-users@sunsite.dk Subject: Re: Completing comma seprated list of option values in _atguments In-Reply-To: <005601c1bb9a$7f047200$21c9ca95@mow.siemens.ru> References: <005601c1bb9a$7f047200$21c9ca95@mow.siemens.ru> X-Mailer: VM 6.95 under 21.5 (patch 3) "asparagus" XEmacs Lucid Borsenkow Andrej wrote: > I must be entirely stupid but I cannot figure out how to do it. Values > must be generated on the fly not chosen from fixed array. And _values > seems to want fixed values only :( Yes, _values is not intended for that, although it depends on how the values are generated, of course... We probably don't need utility functions for everything, simple solution, not that nice, but ok when values may appear more than once: local expl compset -P '*,' _wanted foos expl foo compadd -qS, calculated values More sophisticated, values may appear only once: local expl comps suf comps=(value calculation goes here) compset -P '*,' comps=( ${comps:#${~IPREFIX//,/|}} ) if [[ $#comps -gt 1 ]]; then suf=(-qS,) else suf=() fi _wanted foos expl foo compadd $suf $comps If you want to generate the matches even later, I'd suggest using the first version with _wanted calling a utility function that builds the matches. But if those values are the only possible matches in that context and hence are the normal completions in that case it's probably not worth it and the code above should be enough. Bye Sven -- Sven Wischnowsky wischnow@berkom.de