Add --json output flag to brotab list
This adds a --json flag to brotab list.
The output format looks like this:
[{"id": "a.1.186","title": "Add --json output flag to brotab list by pschmitt · Pull Request #113 · balta2ar/brotab","url": "https://github.com/balta2ar/brotab/pull/113"}]
Was hoping I'd find an open issue/PR re: json output. I'd find it really useful is this something you're interested in @balta2ar ?
edit: using this for now
brotab list |
# Converts each line of tab delimited output to a JSON list
awk -F'\t' '{
printf "[";
for(i=1; i<=NF; i++) {
printf "%s\"%s\"", (i>1 ? "," : ""), $i
}
print "]"
}' |
# Creates an object to add labels
jq -c '{ id: .[0], title: .[1], url: .[2] }'
@pschmitt It's good start for #124, but I'm sure that to continue we need support from plugin/addon backend. ;-( @jackmac92 It can be done much easier:
brotab list | \
jq -Rc 'split("\t")|with_entries(.key|=["id","title","url"][.])'
@pschmitt It's good start for #124, but I'm sure that to continue we need support from plugin/addon backend. ;-( @jackmac92 It can be done much easier:
brotab list | \ jq -Rc 'split("\t")|with_entries(.key|=["id","title","url"][.])'
thanks!! mine was running into some issues with special chars, this looks much better