Zsh Mailing List Archive
Messages sorted by:
Re: Redirection completion
- X-seq: zsh-workers 16806
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- To: Sven Wischnowsky <wischnow@xxxxxxxxx>, zsh-workers@xxxxxxxxxx
- Subject: Re: Redirection completion
- Date: Mon, 11 Mar 2002 16:56:07 +0000
- In-reply-to: <15500.40522.132670.814408@xxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <15500.37377.808155.293654@xxxxxxxxxxxxxxxxxx> <19534.1015846146@xxxxxxx> <15500.40522.132670.814408@xxxxxxxxxxxxxxxxxx>
On Mar 11, 1:08pm, Sven Wischnowsky wrote:
} Peter Stephenson wrote:
} > if I'm in some generic form of redirection completion I can still check
} > for `-redirect-echo-2>' in pattern-files, or does the context still just
} > look like `-redirect-2>' or `-redirect--default-'?
} But I'm not really sure which string to prefer in each case. I'd
} prefer the most specific one, i.e. `-redirect-echo-2>' in this case.
} Would that be ok for our users if we document it?
I think using the most-specific is fine, but I'd like to request a change
in the format.
Firstly I'd like to keep the "flavor" of redirection tightly associated
with the word `redirect', i.e. rather than
It should be
Then, I think, it would not be necessary to try each of `-redirect-',
`-redirect-2>', and `-redirect-2>-echo' in turn, because styles could be
written easily with wildcards e.g. `-redirect-*' or `-redirect-2>*'.
Unless I'm missing something about why all three are tried?
This points up the second change I'd like to request: Make this style
fragment work the same way that styles in general work, e.g., define a
fixed set of delimiter-separated segments and have them always be there
even if sometimes empty. E.g. supposing we switched to comma as the
delimiter, as Sven tossed out in one of the earlier messages on this
thread, the context would look like `-redirect-,2>,echo' and if for some
reason the command name were not known it would be `-redirect-,2>,'.
I suppose strictly speaking the first of those commas could be omitted
because we must always know what redirection operator we're dealing with
(else we wouldn't be in -redirect- context at all), e.g. `-redirect-2>,'.
Random additional comments:
If we do stick with hyphens, what does the context look like in the case
of completion after:
zsh% - 2>
(It's perfectly legal syntax to put the redirection anywhere on the line,
even before the command for which the precommand modifier is intended.)
If we instead switch to commas, what do we do in case of a command named
`,'? (I knew people in grad school who used a csh script named that, for
reasons too obscure to go into). On a similar note, do we need to fix
somehow the existing contexts for completing after the `:' command?
Different tack: If I have
zsh% ls >
with the cursor positioned ON the `>', what context(s) get tried when I
press TAB? I might expect it to complete file descriptor numbers ...
and in that case, I'd want to complete only the numbers of *valid* file
descriptors, but those aren't available to shell functions (yet).
Bart Schaefer Brass Lantern Enterprises
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
Messages sorted by: