From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23726 invoked by alias); 10 Nov 2010 12:11:42 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 15531 Received: (qmail 15354 invoked from network); 10 Nov 2010 12:11:40 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Wed, 10 Nov 2010 12:11:07 +0000 From: Peter Stephenson To: Zsh Users Subject: Re: Completing multiple states with _arguments Message-ID: <20101110121107.3303c6c5@pwslap01u.europe.root.pri> In-Reply-To: References: <20101110102034.679387f9@pwslap01u.europe.root.pri> Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 10 Nov 2010 12:11:07.0683 (UTC) FILETIME=[5AE6F730:01CB80D0] X-Scanned-By: MailControl A-10-90-03 (www.mailcontrol.com) on 10.68.0.134 On Wed, 10 Nov 2010 12:23:50 +0100 Nikolai Weibull wrote: > >> local context state line > >> typeset -A opt_args > >> > >> _arguments \ > >> =C2=A0 ':: :->something-optional-before-files' \ > >> =C2=A0 '*:: :->file' && ret=3D0 > >> > >> # Now what? >=20 > Is it as simple as >=20 > local s > for s in $state; do > case $s in =E2=80=A6 esac > done >=20 > 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. --=20 Peter Stephenson 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, Cambr= idge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom