Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
More-verbose tab-completion idiom?
- X-seq: zsh-users 27569
- From: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: More-verbose tab-completion idiom?
- Date: Wed, 16 Mar 2022 20:26:52 -0400
- Archived-at: <https://zsh.org/users/27569>
- List-id: <zsh-users.zsh.org>
- Openpgp: url=https://www.security.spodhuis.org/PGP/keys/keys-2013rsa-2020cv25519.asc
Folks,
I have a command (`nats`) which takes a "context", and where that can be
set as an environment variable. I have tab-completion of these working,
based upon knowing where the contexts are stored. Each context is a
JSON file in a specific directory, but I mostly only need the name.
But, I could provide a more detailed description, by parsing the
.description field from the JSON file. AFAIK this is going to be
external shell-outs to jq right now (unless anyone has a solid reliable
pattern for JSON extraction from a simple KV object in zsh?).
This is relatively expensive and I don't want to do it by default. I
mean, if most people have at most 3 contexts then it might be sane for
them, but I have 35 and while I might be an outlier, I can believe there
would be people with more.
Is there a standard idiom and keybinding for "go ahead and get the
expensive data, to provide me with more details to choose between the
options", or would I be creating this from scratch?
My completion for this command also gets pointed at by the installer,
so I really want to make sure that what I end up with is not a baroque
Phil Special but instead something which fits better with whatever the
plugin ecosystems are doing, etc.
I know about use-cache etc and have that in other completions of mine,
so if there's no existing idiom for "trigger expensive completion" then
I will use a zstyle to let people request "descriptions" for this
completion, and use-cache if that's set. I'm asking in case there's a
better way I'm not familiar with.
Thanks,
-Phil
Messages sorted by:
Reverse Date,
Date,
Thread,
Author