Commit graph

6 commits

Author SHA1 Message Date
Heath Stewart
e83e049306
Wrap JSON arrays, objects in array with --slurp
Effectively copies `jq --slurp` since `--jq` already uses the same grammar.
2024-04-04 01:26:05 -07:00
Heath Stewart
8e27e9a8cd
Merge JSON responses from gh api
Partly resolves cli/cli#1268 and replaces cli/cli#5652. Requires cli/go-gh#148 to be merged and optionally released.
2024-04-04 01:06:43 -07:00
Mislav Marohnić
63a4319f6c
api: output a single JSON array in REST pagination mode (#7190)
When fetching N pages, avoid printing N separate JSON arrays to the output stream. Instead, massage the output so that the N pages of data are merged into a single JSON array. This is achieved by omitting the final `]` for the first page, and omitting the initial `[` for all subsequent pages.
2023-06-09 20:55:06 +02:00
Robin Neatherway
0e51ec1699 Correct benign mistake in off-by-one guard
m[2] is the third element of m, rather than the second, so we have to
check instead that the len of m is at least 3.

Because the regular expression has two capture groups, the length of m
will always be 3, so currently the guard will always be true.
2021-08-19 14:41:04 +01:00
Mislav Marohnić
c945fb4336 Automatically add per_page=100 to paginated REST requests
Most endpoints respect this parameter by default. Those that don't will
just ignore it. The `per_page=100` parameter is not added if there is
already a `per_page` parameter specified in the request.
2020-06-23 18:42:57 +02:00
Mislav Marohnić
f4ecd365a6 api command: add GraphQL support for --paginate 2020-06-17 18:02:20 +02:00