Removing terminal whitelist for pager mechanism (#4843)
This commit is contained in:
+3
-16
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user