Skip to content

Latest commit

 

History

History
22 lines (19 loc) · 1.2 KB

File metadata and controls

22 lines (19 loc) · 1.2 KB

Filter API Results with jq

curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/orgs/gruntwork-io/repos | \
  jq '.[] | select(.url | contains("installer")) | {private: .private, url: .url}'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  186k    0  186k    0     0   156k      0 --:--:--  0:00:01 --:--:--  156k
{
  "private": false,
  "url": "https://api.github.com/repos/gruntwork-io/gruntwork-installer"
}

References

  1. Filter objects based on the contents of a key (JQ Cookbook)
  2. How to filter an array of objects based on values in an inner array with jq?
  3. jq Tutorial
  4. jq Manual (development version)
  5. List organization repositories
  6. Check if Git repository is private or public (e.g. for GitHub) using Java