From 669cb0a9a475e4f66d837a305800d3eb8ae784a1 Mon Sep 17 00:00:00 2001 From: Sveinn Date: Fri, 9 Feb 2024 22:18:24 +0000 Subject: [PATCH] Removing terminal whitelist for pager mechanism (#4843) --- cmd/globals.go | 19 +++---------------- cmd/main.go | 2 +- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/cmd/globals.go b/cmd/globals.go index 9344df8f17..4c355bdb55 100644 --- a/cmd/globals.go +++ b/cmd/globals.go @@ -22,7 +22,6 @@ import ( "context" "crypto/x509" "net/url" - "os" "time" "github.com/charmbracelet/lipgloss" @@ -86,26 +85,14 @@ var ( // Terminal height/width, zero if not found globalTermWidth, globalTermHeight int - globalDisablePagerFlag = "--disable-pager" - globalPagerDisabled = false - globalHelpPager *termPager - globalPagerEnabledTerms = map[string]bool{ - "screen-256color": true, - "xterm": true, - "xterm-256color": true, - "tmux": true, - "tmux-256color": true, - } + globalDisablePagerFlag = "--disable-pager" + globalPagerDisabled = false + globalHelpPager *termPager // CA root certificates, a nil value means system certs pool will be used globalRootCAs *x509.CertPool ) -func terminalSupportsPager() (ok bool) { - _, ok = globalPagerEnabledTerms[os.Getenv("TERM")] - return -} - func parsePagerDisableFlag(args []string) { for _, arg := range args { if arg == globalDisablePagerFlag { diff --git a/cmd/main.go b/cmd/main.go index c7017709ad..36c111d24c 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -512,7 +512,7 @@ func registerApp(name string) *cli.App { app.EnableBashCompletion = true app.OnUsageError = onUsageError - if isTerminal() && terminalSupportsPager() && !globalPagerDisabled { + if isTerminal() && !globalPagerDisabled { app.HelpWriter = globalHelpPager } else { app.HelpWriter = os.Stdout