Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: A couple of completion problems



Oliver Kiddle wrote:

> Sven Wischnowsky wrote:
> 
> > So, what do you all think: should we make all automatically found
> > options take their argument as being optional? Should we leave it to
> > the calling functions? Or should we add a style that can be used to
> > give a set of patterns and all options with matching names have their
> > argument turned into an optional one?
> 
> So how would _arguments behave differently if the argument to the long
> option is optional? My thinking is that the behaviour should be the same
> anyway:
> 
> command --foo<tab>   should insert an '=' which is auto-removed by a
> further space
> command --foo=<tab>  should complete the arguments to the foo option
> command --foo <tab>  the space (and lack of '=') surely means that we
> have moved on from the foo option and should be completing other
> options. If the argument to --foo is mandatory, then that's the user's
> problem for not specifying it. By continuing to try to complete
> arguments to --foo, zsh is going to achieve nothing.
> 
> I've probably missed the point somewhere though.

For _arguments a -foo= option means: argument directly following in
the the same word or in the next word. So, in your third case the
difference between an optional and a non-optional argument is that the 
at `bar -foo <TAB>' you can or cannot complete names of other options.

In earlier versions the -foo= didn't accept the argument in the next
word but Tanaka noticed that GNU commands work that way, so it was
changed. Of course in the old version we would have got normal
arguments and options as possible completions in the third case.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author