From: Adam Szkoda <adaszko@gmail.com>
To: zsh-users@zsh.org
Subject: _arguments '(-o --option)'[...] functionality without calling _arguments
Date: Wed, 13 Sep 2023 11:06:58 +0200 [thread overview]
Message-ID: <CAEroKaiTZUbp_o+Vn_puXc3uxqksOM5BR=gAyq935y82ssOAxQ@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 976 bytes --]
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
[-- Attachment #2: Type: text/html, Size: 1337 bytes --]
next reply other threads:[~2023-09-13 9:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-13 9:06 Adam Szkoda [this message]
2023-09-13 11:41 ` Oliver Kiddle
2023-09-13 14:52 ` Adam Szkoda
2023-09-14 11:14 ` Adam Szkoda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAEroKaiTZUbp_o+Vn_puXc3uxqksOM5BR=gAyq935y82ssOAxQ@mail.gmail.com' \
--to=adaszko@gmail.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).