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: Thu, 17 Mar 2022 13:44:15 -0700 [thread overview]
Message-ID: <CAH+w=7Y6XtGs_8k4Uw4vv2=Apo4jkR1TPxOpTEGYAyz_8TfRGA@mail.gmail.com> (raw)
In-Reply-To: <YjKbOBHSJ++JZhH2@fullerene.field.pennock-tech.net>
On Wed, Mar 16, 2022 at 7:21 PM Phil Pennock
<zsh-workers+phil.pennock@spodhuis.org> wrote:
>
> Alas, one of the fields is almost guaranteed to be a URL, thus
> containing a colon, and all of those are fair game in the description
> field.
Are the key-value pairs at least all on one line each? Just choosing
a json file that's lying around on my Ubuntu:
json2hash () {
zmodload zsh/mapfile
setopt localoptions extendedglob
# Might have to undo gmail line wrapping here
typeset -gA $1=(
${(z)${(@)${(f)mapfile[$2]}:#[{}]}/(#b)([^:]#):(*)/${(Q)match[1]}
${(q)${(z)${match[2]%,}}}} )
}
json2hash scopes /usr/share/unity/client-scopes.json
typeset -p scopes
next prev parent reply other threads:[~2022-03-17 20:45 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
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 [this message]
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:
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='CAH+w=7Y6XtGs_8k4Uw4vv2=Apo4jkR1TPxOpTEGYAyz_8TfRGA@mail.gmail.com' \
--to=schaefer@brasslantern.com \
--cc=zsh-users@zsh.org \
--cc=zsh-workers+phil.pennock@spodhuis.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).