From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15897 invoked from network); 13 Jul 2002 19:45:34 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 13 Jul 2002 19:45:34 -0000 Received: (qmail 12319 invoked by alias); 13 Jul 2002 19:45:23 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5160 Received: (qmail 12308 invoked from network); 13 Jul 2002 19:45:23 -0000 Date: Sat, 13 Jul 2002 21:37:28 +0200 From: GoTaR To: Borsenkow Andrej Cc: zsh-users@sunsite.dk Subject: Re: completions issues Message-ID: <20020713193728.GA11214@os> References: <20020710204701.GA3362@os> <1026499603.2775.6.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline In-Reply-To: <1026499603.2775.6.camel@localhost.localdomain> User-Agent: Mutt/1.4i On Fri, Jul 12, 2002 at 22:44:56 +0400, Borsenkow Andrej wrote: > with obvious error checking. If you want to add numbers as descriptions, > somebody else better explains how to do it :-) Ok, I've done this this way, perl rox;) _sms_aliases () { smsas=(`smsaddr -l | perl -ne 's/ /:/; if (/^'$PREFIX'/) {print} else {if (/:'$PREFIX'/) {/^(.*):(.*)$/; print "$2:$1\n"}}'`) _describe "SMS alias" "smsas" } gotar:~: smsaddr -l [tab] SMS alias 6bone -- 509xxx admol -- 602xxx joanne -- 604xxx prudy -- 600xxx rtrzepla -- 692xxx rzuku -- 609xxx gotar:~: smsaddr -l r[tab] SMS alias rtrzepla -- 692xxx rzuku -- 609xxx gotar:~: smsaddr -l 6[tab] SMS alias 600xxx -- prudy 602xxx -- admol 604xxx -- joanne 609xxx -- rzuku 692xxx -- rtrzepla 6bone -- 509xxx And question: how to make it without perl? BTW: _arguments \ '*-sub[subtitles]:subtitles:_files -/ -g \*.\(\#i\)txt' \ '*:multimedia file:_files -/ -g \*.\(\#i\)\(mp3\|mpg\)' $ command [tab] multimedia file News/ OpenOffice.org1.0/ $ command -sub [tab] subtitles News/ OpenOffice.org1.0/ BUT: $ command a1.mpg -sub [tab] subtitles News/ OpenOffice.org1.0/ multimedia file News/ OpenOffice.org1.0/ Why there are these TWO completions? Thanks! -- GoTaR PLD stuff at http://mops.uci.agh.edu.pl/~gotar/