help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Phil Pennock <zsh-workers+phil.pennock@spodhuis.org>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: More-verbose tab-completion idiom?
Date: Wed, 16 Mar 2022 18:20:59 -0700	[thread overview]
Message-ID: <CAH+w=7ahY_spSUq=PqgtD1Kv6j_qQeYC_eNcaucz1_r1KUZf=w@mail.gmail.com> (raw)
In-Reply-To: <YjKATMd5ifSGX7eD@fullerene.field.pennock-tech.net>

On Wed, Mar 16, 2022 at 5:27 PM Phil Pennock
<zsh-workers+phil.pennock@spodhuis.org> wrote:
> 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?).

If it's REALLY simple and both keys and values are properly quoted,
you might be able to get away with

() {
  local IFS='{},:'
  typeset -gA context=( ${(Q)=1} )
} "$(<json_context_file)"

but that assumes you don't have colons or commas or braces in the keys
or descriptions.

  parent reply	other threads:[~2022-03-17  1:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-17  0:26 Phil Pennock
2022-03-17  0:50 ` Daniel Shahaf
2022-03-17  1:26   ` Phil Pennock
2022-03-17  1:20 ` Bart Schaefer [this message]
2022-03-17  1:24   ` Bart Schaefer
2022-03-17  2:21   ` Phil Pennock
2022-03-17 16:30     ` Daniel Shahaf
2022-03-17 20:44     ` Bart Schaefer
2022-03-17 21:38       ` Phil Pennock
2022-03-18  0:28         ` Daniel Shahaf
2022-03-18  1:16           ` Phil Pennock

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7ahY_spSUq=PqgtD1Kv6j_qQeYC_eNcaucz1_r1KUZf=w@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    --cc=zsh-workers+phil.pennock@spodhuis.org \
    --subject='Re: More-verbose tab-completion idiom?' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:


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).