On Mon, Jan 8, 2024 at 8:52 AM Peter Stephenson
wrote:
>
> > On 07/01/2024 20:06 GMT Bart Schaefer wrote:
> >
> > on a quick glance at the code I think they may be identical (that is,
> > that
> > zstyle -L ":completion:$curcontext"
> > would give the desired result), but there's a lot going on in there.
> >
> > So what to do here? Ideas that occur to me ...
> >
> > 2) Add a -q option to -L, to exit 0 or 1 on found or not found,
> > without printing.
>
> The -q and -L combination sounds like it ought to be reasonably easy
> (pass through a flag to suppress output) and ought to be quite flexible
> as -L already has a lot of search configurability built into it, maybe?
Sadly all zstyle options are singletons, that is, it doesn't use the
normal option parsing but only looks at argv[0][1]. Combining options
is not friendly.
Also -L acts more like -g than like -m, and what's wanted here is -m.
That is, -L doesn't apply the zstyle pattern to the context, it treats
the context as a pattern (which is why the doc calls it a
"metapattern") and looks for a zstyle pattern that matches it. Which
could be shoehorned into working, I guess, but is not straightforward
for this use case.
So amend the above to say "add a -q option that acts like -m except ..."
It's possible this could be refactored but that felt uglier than
duplicating a couple of tests.