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

Re: using the description from _arguments foo:description:->state

Mikael Magnusson wrote:
> On 11 September 2011 20:10, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
> > }  "($opts)-A[define widget alias]:old widget:->widget :new

> Can we add a new option to _configure which enables this, so if you
> say _arguments -d you also have to local state_descr. There's a couple
> of other variables that work like this already, -n for NORMARG, -C for
> curcontext.

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.

If you used a function instead of a state, it would be called with the
relevant arguments for the description unless you prefix it with a space
in which case, you'd have to dig around in $expl. Perhaps we could use
some similar syntax to the space prefix instead of an option.

Unless you pass -C to _arguments there is the possibility of more than
one state being possible so any state_descr would need to be an array.
And we can't do arrays of arrays so a state_expl wouldn't be possible
(expl is already an array). That would put me off the whole idea somewhat.

Personally, I'd be inclined to have a separate new-widget state in this
particular function. Alternatively, you could use the value of $context
to get the right description or use a function for completing widgets.


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