From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6730 invoked from network); 15 Feb 2004 00:36:32 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 15 Feb 2004 00:36:32 -0000 Received: (qmail 16485 invoked by alias); 15 Feb 2004 00:36:12 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7058 Received: (qmail 16464 invoked from network); 15 Feb 2004 00:36:12 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 15 Feb 2004 00:36:12 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [207.71.22.228] by sunsite.dk (MessageWall 1.0.8) with SMTP; 15 Feb 2004 0:36:11 -0000 Received: from elm.teratorn.org (unknown [10.0.0.23]) by oak.teratorn.org (Postfix) with ESMTP id 27761335 for ; Sat, 14 Feb 2004 19:04:09 -0600 (CST) To: "zsh-users@sunsite.dk" Subject: Re: completion help References: ARRAY(0xa175c60) <1076789362.2984.181046220@webmail.messagingengine.com> Message-ID: From: Eric Mangold Content-Type: text/plain; format=flowed; charset=iso-8859-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Date: Sat, 14 Feb 2004 16:31:04 -0700 In-Reply-To: <1076789362.2984.181046220@webmail.messagingengine.com> User-Agent: Opera7.23/Linux M2 build 518 On Sat, 14 Feb 2004 15:09:22 -0500, Dwight Shih wrote: > After years of avoidance, I've finally decided to start playing with > completion. Here's what I've got: > > typeset -A opt_args > local contest state line > > _arguments -s -S \ > "1:build:(build test start stop deploy validate help)" \ > "*:file:_files" \ > "-conf[specify configuration file]:file:_files" \ > "-a[automate deploy actions]" \ > "-f[force more or copy]" \ > "-m[move jar]" \ > "-c[copy jar]" \ > "-v(vv vvv)[validate output level 1]" \ > "-vv(v vvv)[validate output level 2]" \ > "-vvv(v vv)[validate output level 3]" \ > && return 0 > > which works as far as it goes. > > What I would like to group options by major mode (the first set of > mutually exclusive options: build test start stop deploy validate and > help) so that only valid options for each mode would apply. So -a -f -m > -c would only apply in the deploy mode and -v -vv -vvv would only apply > in the validate mode. I could easily be way off on this but I think you want to use "sets". See the _arguments documentation. > I'd also like to restrict file completions. For example, I would like to > restrict the -conf file completion to be limited to *.xml and the general > file completion to be limited to *.jar. The _files documentation explains this. You want to use the -g argument as in: _files -g "*.xml" -Eric