Zsh Mailing List Archive
Messages sorted by:
Re: Redirection completion
- X-seq: zsh-workers 16799
- From: Sven Wischnowsky <wischnow@xxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: Redirection completion
- Date: Mon, 11 Mar 2002 12:16:17 +0100
- In-reply-to: <3922.1015844089@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <15500.28153.769884.199234@xxxxxxxxxxxxxxxxxx> <3922.1015844089@xxxxxxx>
Peter Stephenson wrote:
> Sven Wischnowsky wrote:
> > So, I wrote the patch below. Removing the -T stuff and consistently
> > using names like `-value-foo' or `-redirect-echo-2>' everywhere, both
> > for the context used for styles and for compdef/#compdef (that's why
> > we don't need separated sets of completion functions anymore).
> This makes a lot of sense.
> I haven't quite understood how this system
> handles the difference between `-redirect-2>' and `-redirect-echo-2>'.
> Suppose I defined a redirection for the former, will I still get a
> context including `-redirect-echo-2>'? And is that the same for a plain
> `-redirect-'? I would guess yes, since the context depends on what you
> are completing rather than what function is doing it (and patterns are a
> more natural part of styles than of compdef definitions).
The functions calling _dispatch give it a bunch of string that are to
be looked up in order until one with a defined function is found.
And, in this case, _redirect makes sure to give first `-redirect-echo-2>',
then `-redirect-2>'. So you can define a special version for echo and
another one for completion after `2>' everywhere else. _dispatch adds
to this the context `-default-' preceded by the prefix it was given,
so default redirection completion is defined by `-redirect--default-',
which is what is now in _files.
_redirect itself is still in charge of the context -redirect- itself.
> The only worry is that someone, somewhere will decide it's a great idea
> to have commands beginning with `-' for some special use. I don't see
> how we can guard against that in general, though. We can't make the
> current set of completion functions indendent of the choice of
> character. We may just as well stick with -. Maybe we could allow it
> to be escaped, like `:' (often) can be.
Hm, yes, although having to quote a hyphen looks weird. I would have
suggested usin `|' if that weren't a pattern matching character.
Safer would be `;' but that looks too much like a colon for my taste.
Maybe use a comma?
Sven Wischnowsky wischnow@xxxxxxxxx
Messages sorted by: