Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@tgyurci
Copy link
Contributor

@tgyurci tgyurci commented Sep 23, 2020

Allow setting pager in config file to an empty string. This disables
the pager completely and all output will be unpaged regardless of
the PAGER environment variable.

This replicates the behaviour of the core.pager Git configuration
option.

@Destop-Trang1801

This comment has been minimized.

@Destop-Trang1801

This comment has been minimized.

Allow setting `pager` in config file to an empty string.  This disables
the pager completely and all output will be unpaged regardless of
the PAGER environment variable.

This replicates the behaviour of the `core.pager` Git configuration
option.
@jacobat
Copy link

jacobat commented Sep 24, 2020

I think you can set the pager to cat

@tgyurci
Copy link
Contributor Author

tgyurci commented Sep 24, 2020

Setting pager to cat solves the issue, I just simply didn't think of that. But using cat as pager is just a workaround the original issue, that the pager can't be disabled and thus gh executes another process just to do nothing.

Copy link
Contributor

@samcoe samcoe left a comment

Choose a reason for hiding this comment

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

This code looks good to me. I like having the ability to explicitly disable the pager in configuration file, and also like mirroring the way git handles it. I think we should also specify in pkg/cmd/root/help_topic.go this new way to disable the pager. Going to wait for a second set of eyes before merging.

@samcoe samcoe requested review from mislav and vilmibm September 24, 2020 15:07
Copy link
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

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

Thanks for this! I like the approach, but since we already generate the user's default configuration file with the pager: (blank value) line, this change would basically disable pager for everyone who hasn't changed the default in their settings, regardless of their PAGER settings.

I'm guessing that the primary need is a way to override PAGER specifically for gh. I'm thinking that we should add an additional GH_PAGER environment variable and also support the special value of pager: cat in the user's config file as a way to disable pager completely. (We should not actually execute cat as a sub-process, since that would be a waste of resources.)

@tgyurci
Copy link
Contributor Author

tgyurci commented Sep 29, 2020

Despite I think the clearest solution would be to set pager to "", I understand that it would change the current behavior. So I've created tow PRs for "cat" and GH_PAGER: #2021 #2020

@vilmibm vilmibm removed the community label Sep 29, 2020
@mislav
Copy link
Contributor

mislav commented Sep 30, 2020

@tgyurci Thank you so much for all the PRs!

Now that we have two additional mechanisms to override the system PAGER in gh, I'm going to close this. 🙇

@mislav mislav closed this Sep 30, 2020
@tgyurci
Copy link
Contributor Author

tgyurci commented Sep 30, 2020

If it worth it, I can extract the config source refining part from it. What do you think?

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.

6 participants