Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: completion for perldoc
- X-seq: zsh-workers 7679
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: PATCH: completion for perldoc
- Date: Tue, 7 Sep 1999 10:32:00 +0200 (MET DST)
- In-reply-to: Adam Spiers's message of Mon, 6 Sep 1999 19:18:10 +0100
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Adam Spiers wrote:
> Sven Wischnowsky (wischnow@xxxxxxxxxxxxxxxxxxxxxxx) 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@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author