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

_arguments '(-o --option)'[...] functionality without calling _arguments



Hi ZSH hackers!

I'm trying to achieve a certain quite specific completion effect.  I basically want to steal it from the cargo completion script.  I can't find it in the source code of the _arguments function.

Rust's cargo completion script has this line in it: _arguments '(-p --package)'{-p+,--package=}'[specify package to build]:package:_cargo_package_names'

This results in very nice and compact completions where --package and -p are grouped in a single line and share the same description, yet each of them can be selected separately.  This is great.

Yet I can't find the code in _arguments that's responsible for this.  I'm suspecting it's delegating to the comparguments builtin ([1])?

Is it possible to achieve that by calling compadd directly?  Maybe by calling comparguments directly somehow?

Thanks in advance!
— adaszko

[1] https://github.com/zsh-users/zsh/blob/95269147fcbd85961d652ab419bb168a8aafcd14/Src/Zle/computil.c#L2590


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