Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: completions issues



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 <gotar@xxxxxxxxxxxxx>
PLD stuff at http://mops.uci.agh.edu.pl/~gotar/



Messages sorted by: Reverse Date, Date, Thread, Author