Removing terminal whitelist for pager mechanism (#4843)

This commit is contained in:
Sveinn
2024-02-09 14:18:24 -08:00
committed by GitHub
parent 62b12a2770
commit ea1e65f971
2 changed files with 4 additions and 17 deletions
+3 -16
View File
@@ -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 {
+1 -1
View File
@@ -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