Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Completing multiple states with _arguments
- X-seq: zsh-users 15531
- From: Peter Stephenson <Peter.Stephenson@xxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Completing multiple states with _arguments
- Date: Wed, 10 Nov 2010 12:11:07 +0000
- In-reply-to: <AANLkTimr25=Yab5DHRHg+SOPioh-C6byZ+ieGr+KmtPA@xxxxxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Organization: Cambridge Silicon Radio
- References: <AANLkTintH3mBrt+_csUYuJX8FM76_j6AhPXjoXCU2WXP@xxxxxxxxxxxxxx> <20101110102034.679387f9@xxxxxxxxxxxxxxxxxxxxxxxxx> <AANLkTimr25=Yab5DHRHg+SOPioh-C6byZ+ieGr+KmtPA@xxxxxxxxxxxxxx>
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.
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
Messages sorted by:
Reverse Date,
Date,
Thread,
Author