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

Re: How to complete with _arguments() depending on an option and within a loop



On Wed, May 12, 2021 at 8:15 AM Philippe Proulx <eeppeliteloop@xxxxxxxxx> wrote:
>
> I believe the complexity of Zsh completion can translate into better
> command line UX.

Certainly.

> Why would _argument() support not repeating an option (the default)
> then (`--opt[my option]` vs `*--opt[my option]`)?

It's a degrees-of-effort thing.

There's a (subjective) point at which the effort to limit the
completion results to exactly what "makes sense" in a given context,
exceeds the benefit of doing so.  I think that a lot of the time the
benefit is given so much weight that the effort becomes unreasonable.
Completion shouldn't offer nonsense (like the \"\"\" result in another
recent thread, that's clearly a bug) but it's rarely going to achieve
perfection.

Returning to your specific question, you might look at using
_regex_arguments instead.  If you can figure out the syntax, you can
put almost unlimited effort into making the result perfect.




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