Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: optional argument?
- X-seq: zsh-workers 11249
 
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
 
- To: zsh-workers@xxxxxxxxxxxxxx
 
- Subject: Re: optional argument?
 
- Date: Mon, 8 May 2000 11:44:16 +0200 (MET DST)
 
- In-reply-to: Tanaka Akira's message of 06 May 2000 02:53:50 +0900
 
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
 
Tanaka Akira wrote:
> In article <200004250945.LAA03283@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
>   Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx> writes:
> 
> > > Because an argument for `-o' is optional, `xxx' is an argument for the
> > > option or first non-option argument.  So, the word to be completed by
> > > <TAB> is first non-option argument or second non-option argument.
> > > Hence `arg1' and `arg2' should be completed.  But I think this is bit
> > > confused and not so useful.
> > 
> > Oh, did you have to say that?
> 
> I found an example.
> 
> Z(4):akr@serein% Src/zsh -f
> serein% Src/zsh -f
> serein% bindkey -e; fpath=($PWD/Completion/*(/)); autoload -U compinit; compinit -D; compdef _tst tst
> serein% zstyle ':completion:*' group-name ''
> serein% zstyle ':completion:*:messages' format %d
> serein% zstyle ':completion:*:descriptions' format %d
> serein% diff --context ChangeLog <TAB>
> original file
> ...
> new file
> ...
> 
> This is caused by optional argument for --context.  In this position,
> _diff_options should completes only new files: second file set.  In
> general, optional argument of _arguments always causes similar
> problem, I think.  So, I think it is bit confused and not so useful.
Well, in this case it is really caused by --context not accepting its
argument in a separate word.
Hm, what are we supposed to do now? Generally making it not complete
normal arguments when in a position for an optional option-argument
wouldn't solve the problem. Making it not complete optional option-
arguments in separate words could be wrong, too, for commands that can 
find out if the argument is a normal or for the option.
Hrmpf. Make `='-options complete the argument *only* after the equal
sign? Add a new specification type, say `-opt==' for options that
don't accept the argument in a separte word (should the long-option
auto-detection code use it then?)?
I think I prefer the latter. Opinions?
Bye
 Sven
--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author