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

Re: Completing multiple states with _arguments



On Wed, Nov 10, 2010 at 13:11, Peter Stephenson
<Peter.Stephenson@xxxxxxx> wrote:
> On Wed, 10 Nov 2010 12:23:50 +0100
> Nikolai Weibull <now@xxxxxxxx> wrote:
>> >> local context state line
>> >> typeset -A opt_args
>> >>
>> >> _arguments \
>> >> Â ':: :->something-optional-before-files' \
>> >> Â '*:: :->file' && ret=0
>> >>
>> >> # Now what?
>>
>> Is it as simple as
>>
>> local s
>> for s in $state; do
>> Â case $s in â esac
>> done
>>
>> or do you need to deal with tags and such through _alternative or so?
>
> I think you do need to set up tags here, at least most scripts do and I
> haven't tried without. ÂHowever, that should all be standard: looping
> over the states is fine, then use the usual _wanted stuff inside the
> case and the tags get sorted out automatically, in principle. ÂThere's
> nothing to stop you using _alternative, either.
>
> In short, just adding the loop over the state to the sort of stuff that
> usually appears in the "case" here should be OK.

OK, thank you.  Iâll report my findings.



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