Comment

Comment by xg15

The most effective combination I've found so far is jq + basic shell tools.

I still think jq's syntax and data model is unbelievably elegant and powerful once you get the hang of it - but its "standard library" is unfortunately sorely lacking in many places and has some awkward design choices in others, which means that a lot of practical everyday tasks - such as aggregations or even just set membership - are a lot more complicated than they ought to be.

Luckily, what jq can do really well is bringing data of interest into a line-based text representation, which is ideal for all kinds of standard unix shell tools - so you can just use those to take over the parts of your pipeline that would be hard to do in "pure" jq.

So I think my solution to the OP's task - get all distinct OSS licenses from the project list and count usages for each one - would be:

curl ... | jq '.[].license.key' | sort | uniq -c

That's it.

parent xg15 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton