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

Re: More-verbose tab-completion idiom?



On Wed, Mar 16, 2022 at 7:21 PM Phil Pennock
<zsh-workers+phil.pennock@xxxxxxxxxxxx> 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




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