From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8691 invoked by alias); 10 Nov 2010 11:00:04 -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: 15529 Received: (qmail 5959 invoked from network); 10 Nov 2010 10:59:53 -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 10:20:34 +0000 From: Peter Stephenson To: Zsh Users Subject: Re: Completing multiple states with _arguments Message-ID: <20101110102034.679387f9@pwslap01u.europe.root.pri> In-Reply-To: References: 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=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 10 Nov 2010 10:20:34.0799 (UTC) FILETIME=[E9652FF0:01CB80C0] X-Scanned-By: MailControl A_10_80_00 (www.mailcontrol.com) on 10.71.0.127 On Tue, 9 Nov 2010 23:49:41 +0100 Nikolai Weibull wrote: > Hi! > > How do I deal with multiple states when completing with _arguments? > > local context state line > typeset -A opt_args > > _arguments \ > ':: :->something-optional-before-files' \ > '*:: :->file' && ret=0 > > # Now what? Usually you would use "case $state ... esac" to handle the states, with matches against something-optional-before-files, file, etc. There are quite a few uses of this if you search for $state in completion. -- 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, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom