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

Re: completion, sorting of options



From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
Date: Wed, 8 Nov 2023 12:09:20 -0800

> On Wed, Nov 8, 2023 at 5:25?AM Thomas Lauer <thomas.lauer@xxxxxxxxxx> wrote:
> >
> > Apparently there's no obvious solution to the zstyle "sort false/nosort"
> > thing.
> 
> The short answer here is that you can't do this with a single call to
> _arguments.  The option parsing in _arguments creates two lists, one
> of options that don't take values and one of options that do, and
> subsequently it passes them to compadd in two separate calls, so
> compadd sees them in that order even though _arguments does not.
> 
> The "simplest" thing to do here might be to make an array of the
> options that must be in a particular order, and then loop that array
> calling _arguments once for each, and then make a final call to
> _arguments with all the other specs.
> 
> > zstyle ':completion:*:*:mycmd:*:*' sort nosort_and_i_really_mean_nosort
> 
> Not likely to happen as it would mean a significant change to the deep
> guts of _arguments.

As the :-) in my message showed (or perhaps didn't) this was not really
a serious suggestion. It's just a bit frustrating that what I'd call an
implementation detail within _arguments makes this call perform in a way
a (probably naive) user doesn't expect and can't easily grok or rectify.

Anyway, thanks for the clarification.  T




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