From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3881 invoked by alias); 10 Nov 2010 11:24:06 -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: 15530 Received: (qmail 11466 invoked from network); 10 Nov 2010 11:23:55 -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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.161.171 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=b9PWkrnnxGh3GusEQ0ZsHCQIhMNz3UzPatcZwoOKw60=; b=Zwx910q7Qz3JQit3f44VdJLIqpAOzlcdoPhFeK2RLziMdU4zXo5bpt2WOhIaEwTOk+ BLYhQLoFpBrPQOXkyuZlQ8rO5RNjCrai0DB4MkjSYyF3Ku+C4hOQkcDlFxuds+ByWNTR joIp277CvGgz/jmsAd8zC2MVod/IgdCoB2r3s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=jwC7bSA+WhZx0W6nsqg/Pbk29Pmx6b0dv9J3U8JwNv6ZDMuxw+1NNUuzN7zofqmQsb 4kOlpFNYIWR+/lZHAoxU8cDvMdpa0nmCzBV4Ev8SjZ4Jh2ZiwdWfapoELMLepPepbXdi 5DcjeI8FHI0abKJLSt/VtcFAvEOpgGFagCfPI= MIME-Version: 1.0 Sender: nikolai.weibull@gmail.com In-Reply-To: <20101110102034.679387f9@pwslap01u.europe.root.pri> References: <20101110102034.679387f9@pwslap01u.europe.root.pri> Date: Wed, 10 Nov 2010 12:23:50 +0100 X-Google-Sender-Auth: zNmOC4iGaudo5EOo5JLnnbrlitI Message-ID: Subject: Re: Completing multiple states with _arguments From: Nikolai Weibull To: Peter Stephenson Cc: Zsh Users Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, Nov 10, 2010 at 11:20, Peter Stephenson wrote: > On Tue, 9 Nov 2010 23:49:41 +0100 > Nikolai Weibull wrote: >> How do I deal with multiple states when completing with _arguments? >> >> local context state line >> typeset -A opt_args >> >> _arguments \ >> =C2=A0 ':: :->something-optional-before-files' \ >> =C2=A0 '*:: :->file' && ret=3D0 >> >> # Now what? > > Usually you would use "case $state ... esac" to handle the states, with > matches against something-optional-before-files, file, etc. =C2=A0There a= re > quite a few uses of this if you search for $state in completion. No, no, $state is (something-optional-before-files file) in this case. Is it as simple as local s for s in $state; do case $s in =E2=80=A6 esac done or do you need to deal with tags and such through _alternative or so?