4 ms·
You can trivially approximate gron with jq, and you there are jq implementations of gron too, like https://gist.github.com/mkfmnn/7b637aa0ec9b0422b3b75ec181a132
by cryptonector 3y ago
You can trivially approximate gron with jq, and you there are jq implementations of gron too, like https://gist.github.com/mkfmnn/7b637aa0ec9b0422b3b75ec181a132fc https://gist.github.com/mkfmnn/7b637aa0ec9b0422b3b75ec181a13...
E.g.,
# gron
gron "https://api.github.com/repos/tomnomnom/gron/commits?per_page=1" |
fgrep commit.author
json[0].commit.author = {};
json[0].commit.author.date = "2016-07-02T10:51:21Z";
json[0].commit.author.email = "mail@tomnomnom.com";
json[0].commit.author.name = "Tom Hudson";
# jq
curl -L "https://api.github.com/repos/tomnomnom/gron/commits?per_page=1" |
jq -r 'paths(scalars) as $p | getpath($p) | "\($p|join(".")|select(contains("commit.author"))) = \(.)"'
0.commit.author.name = Tom Hudson
0.commit.author.email = mail@tomnomnom.com
0.commit.author.date = 2022-04-13T14:23:37Z
# jq with grep outside jq
curl -L "https://api.github.com/repos/tomnomnom/gron/commits?per_page=1" |
jq -r 'paths(scalars) as $p | getpath($p) | "\($p|join(".")) = \(.)"' |
fgrep commit.author
0.commit.author.name = Tom Hudson
0.commit.author.email = mail@tomnomnom.com
0.commit.author.date = 2022-04-13T14:23:37Z
With just a bit more work you can get it to output valid gron, and even to parse valid gron.
- archgoon 3y ago[dead]