Skip to content

Add api --paginate option - #1222

Merged
mislav merged 4 commits into
trunkfrom
api-pagination
Jun 23, 2020
Merged

Add api --paginate option#1222
mislav merged 4 commits into
trunkfrom
api-pagination

Conversation

@mislav

@mislav mislav commented Jun 16, 2020

Copy link
Copy Markdown
Contributor

gh api --paginate repos/:owner/:repo/issues automatically fetches and prints all pages of all results until there are no more pages.

TODO:

  • GraphQL pagination
  • automatically set per_page=100 in pagination mode?

Fixes #1184

@mislav
mislav requested a review from a team June 16, 2020 16:22

@vilmibm vilmibm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i love it

@vilmibm

vilmibm commented Jun 17, 2020

Copy link
Copy Markdown
Contributor

automatically set per_page=100 in pagination mode?

seems reasonable? why wouldn't we?

@AliabbasMerchant

Copy link
Copy Markdown
Contributor

1 small point:
paginate means "dividing a document into discrete pages, either electronic pages or printed pages."
Since we are doing the exact opposite, I don't think the command should be named --paginate. Some users (like me) will find it unintuitive.
Maybe --compile, or --depaginate or --combine?

@mislav

mislav commented Jun 22, 2020

Copy link
Copy Markdown
Contributor Author

@AliabbasMerchant That's a valid point, but I still feel that "paginate" describes this feature the best since it performs "pagination" (a concept described by that term in GitHub API docs) for you.

I feel that none of the alternate terms that you've suggested are established enough that we could use them as alternatives. Furthermore, I think that --paginate is useful to keep as a term because the caller needs to be aware that multiple HTTP requests will be made by the client to get all pages of results (and each will count towards the API request limit).

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.
@mislav
mislav merged commit 657e633 into trunk Jun 23, 2020
@mislav
mislav deleted the api-pagination branch June 23, 2020 17:01
This was referenced Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

api command: add pagination option

3 participants