Zsh Mailing List Archive
Messages sorted by:
Re: using the description from _arguments foo:description:->state
> On Sep 21, 1:39pm, Oliver Kiddle wrote:
> } While we could, there's always the possibility that some function
> } somewhere has a -d that's intended to me an argument to be completed.
> That condition is already handled by using e.g. "_arguments -n : -n".
True but that doesn't help for backward compatibility with old
> Before producing my patch I first thought about digging around in $expl,
> but $expl is already marked up for use with _format, so that doesn't
> really work. Also $expl is only passed *down* from _arguments, not back
> up to the caller.
Well states are just a lazy way of avoiding separate functions. It'd be
nicer to get $expl across to them despite it not strictly being down
the call stack. However, I'll admit that having the description alone
is better than nothing.
> Yes, that's what my patch does. $state_descr is an array parallel to
Sorry, it looks like I should have checked and read the beginning of the
thread before weighing in.
> Yes, that would work in _zle, but other callers of _arguments are already
> passing a description which _arguments parses out, only to then throw it
> away. Shouldn't we keep that parsing in one place and make it useful?
Yes, fair enough. In many cases, the descriptions have been left blank
where they get thrown out in this manner but it would be nicer to have
them cleanly in one place.
So given that you "don't think adding -d buys much" and there is the
compatibility issue I mentioned, what would you suggest? A local in
_main_complete would fall down in the case of a function using states
calling another function that also uses states but which doesn't declare
state_descr local. _arguments isn't used much from helpers but _values
is. Perhaps _arguments/_values could leave state_descr alone where
the description is blank or consists of just a space. That way the
documentation could also indicate that functions need only declare
state_descr local if they give a description for their states. The
implementation would have to take care in the case where $state has more
than one element, however.
Messages sorted by: