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

Re: PATCH: Re: Assorted _arguments arguments



Bart Schaefer wrote:

> ...
> 
> I haven't really worked at understanding _argument_sets very much, but:
> 
> As I understand it, _argument_sets only works for fairly simple option
> combinations.  As soon as you start needing ->state and the like, it's
> necessary to revert to using _arguments directly.  Is it possible to
> combine the two in some useful way so that it isn't necessary to give
> up the above convenience in order to do more complex parsing?

The only real problem _argument_sets currently has with `->state'
actions is when there are more than one state returned at the same
time. Especially for actions defined in the common options/args part:
you'll get the state/context more than once in $state and $context
(and just using `typeset -U' doesn't work, because the contexts may be 
different, including the set-name).

However, _argument_sets was mostly written to give us a way to play
with this, test it. The syntax (the `-' to separate sets) was chosen
because `-' currently makes comparguments/_arguments report an invalid 
argument. So... we could try to put the whole functionality of
_argument_sets into _arguments, implement it (mostly) in C. I would
then write it there as we have it in shell code now: as a wrapper
around the existing code. That was the problem that led to the
implementation we have now: changing all of comparguments to support
multiple sets is extremly complicated (and error-prone).

Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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