Skip to content

Pager should not be used for empty output #6400

@mgabeler-lee-6rs

Description

@mgabeler-lee-6rs

Describe the bug

I have PAGER set in my environment to tell various tools my preferred pager. Every tool I use that understands this variable, except gh, understands that output smaller than a single terminal window doesn't need to go through the pager. With gh, it seems the only options are to run everything through a pager, or nothing. Including empty output!

This is annoying and frustrating.

gh version 2.17.0 (2022-10-04)

Steps to reproduce the behavior

  1. Create or find a repo with zero open PRs
  2. Clone this repo
  3. export PAGER=less
  4. Within the clone, run gh pr list
  5. Laugh/cry at less being opened to display byte 0/0 (END)
  6. Note also that gh did produce some output ... that it didn't send to the pager, but which is hidden due to the presence of the pager, until you quit it: no open pull requests in owner/reponame
  7. export GH_PAGER= to make this stop
  8. Cry that now no pager is used even for voluminous output 😢

Expected vs actual behavior

I expect gh to use the configure pager only when there is enough output to merit pagination, like every other tool that supports such config. Compare especially git

Logs

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedContributions welcomep3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions