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

Re: PATCH: Re: Saving the zle display stuff



Oliver Kiddle wrote:

> Sven Wischnowsky wrote:
> > 
> > Oliver Kiddle wrote:
> 
> > > I seem to have some fairly long option exclusion lists in some of my
> > > completions so it might also be worth thinking if there are any better
> > > ways of doing the completion when there are separate forms of the
> > > command. I experimented with a few things like using two calls to
> > > _arguments without much success.
> > 
> > Yep. Any suggestions? ;-)
> 
> I've got some ideas but I'm not sure how workable they would be.
> 
> First, I suppose we would need some syntax to divide the arguments to
> _arguments into separate groups. At a simple level, you could say that
> each group defined the options for a separate form of the command and
> use something like '--' to separate the groups. The main additional
> functionality that this would offer over the current situation is that
> you could define separate non-option arguments (*:... or n:...) for each
> group.

`--' is alredy used for the automatic long-option stuff.

> ...
> 
> In summary, this is grouping the arguments and using common exclusion
> lists for the groups and allowing the groups to exclude other whole
> groups. You could easily expand the above to have longer exclusion lists
> and use the current syntax (although you couldn't deal with two -e and
> two * definitions).

The douled -e is indeed a problem. For one, _arguments currently can't 
report multiple actions (and is happy with the first one it finds if
it finds one). That can probably be changed (I'm not exactly sure how
complicated this would be). But of course, this would give us the same 
problem as for _alternative: the ->state actions. _arguments simply
cannot execute more than one of these because it doesn't execute them
at all. Maybe that could be changed to report all states that have to
be used to the caller, but then every function using multiple sets and 
->state has to be able to deal with that (rows of `if's instead of one
`case' or a `case' in a loop).

Hm. Maybe a wrapper (_multi_arguments) that turns these grouping stuff 
into normal _arguments descriptions (as you suggested) and then an
option to _arguments to allow it to deal with multiply given
options. And a way to say which of the multiple descriptions for the
same option is mutually exclusive, of course.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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