From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9804 invoked from network); 7 Sep 1999 08:32:20 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 7 Sep 1999 08:32:20 -0000 Received: (qmail 24468 invoked by alias); 7 Sep 1999 08:32:05 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7679 Received: (qmail 24446 invoked from network); 7 Sep 1999 08:32:01 -0000 Date: Tue, 7 Sep 1999 10:32:00 +0200 (MET DST) Message-Id: <199909070832.KAA03607@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Adam Spiers's message of Mon, 6 Sep 1999 19:18:10 +0100 Subject: Re: PATCH: completion for perldoc Adam Spiers wrote: > Sven Wischnowsky (wischnow@informatik.hu-berlin.de) wrote: > > Adam Spiers wrote: > > > I noticed Etc/Completion-style-guide soon after posting and realised > > > the many problems with that _perl* :-( > > > > Never mind. All this isn't fixed in stone yet and the `style-guide' is > > quite new. > > I've been uploading the style-guide and the _arguments documentation > to my brain, and improved versions are on the way. _arguments is > great! However a few things perplex me: > > - Why can't you have multiple MESSAGE:ACTION pairs with the > *:MESSAGE:ACTION form? I'm having to resort to using an auxiliary > function, e.g.: There three forms that allow you to specify completion for (non-option-) arguments: `num:mesg:action' specify completion for the num'th argument `:mesg:action' specify completion for the next argument (this is like the first one with `_argument' filling in the number automatically, for the cases where you just specify the completions for all arguments in the normal order one after another) `*:mesg:action' specify completion for `all other' arguments These can be combined, of course: _arguments ':foo:(1 2)' '*:bar:(3 4)' completes `(1 2)' for the first argument and `(3 4)' for all other arguments _arguments '2:foo:(1 2)' '*:bar:(3 4)' completes `(1 2)' for the *second* argument and `(3 4)' for all other arguments > - Is it possible to do something like (-foo)*:MESSAGE:ACTION, i.e. > specifying completion for normal args only if -foo hasn't been > specified? There is no direct support for this. I'm not sure what you really want to have, but I think (or: hope) you can do it with: `-foo:*:mesg1:action1' '*:mesg2:action2' which makes *all* arguments after the option `-foo' be completed with `action1' (if that is empty, nothing will be completed, of course), and if `-foo' is not given, the second specification will be used This can then be used together with some trickery for `action1' to achieve almost everything. If that is not enough or too clumsy to use, I'd like to see the real world example that made you wish for this. And then I'll think about ways to make this easier. Ok? Bye Sven -- Sven Wischnowsky wischnow@informatik.hu-berlin.de