Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enabling MC_DISABLE_PAGER and --dp #4909

Merged
merged 3 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var globalFlags = []cli.Flag{
cli.BoolFlag{
Name: "disable-pager, dp",
Usage: "disable mc internal pager and print to raw stdout",
EnvVar: envPrefix + "DISABLE_PAGER",
EnvVar: envPrefix + globalDisablePagerEnv,
Hidden: true,
},
cli.BoolFlag{
Expand Down
13 changes: 9 additions & 4 deletions cmd/globals.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
"context"
"crypto/x509"
"net/url"
"os"
"strconv"
"time"

"github.com/charmbracelet/lipgloss"
Expand Down Expand Up @@ -89,17 +91,20 @@ var (
// Terminal height/width, zero if not found
globalTermWidth, globalTermHeight int

globalDisablePagerFlag = "--disable-pager"
globalPagerDisabled = false
globalHelpPager *termPager
globalDisablePagerEnv = "DISABLE_PAGER"
globalDisablePagerFlag = "--disable-pager"
globalDisablePagerFlagShort = "--dp"
globalPagerDisabled = false
globalHelpPager *termPager

// CA root certificates, a nil value means system certs pool will be used
globalRootCAs *x509.CertPool
)

func parsePagerDisableFlag(args []string) {
globalPagerDisabled, _ = strconv.ParseBool(os.Getenv(envPrefix + globalDisablePagerEnv))
for _, arg := range args {
if arg == globalDisablePagerFlag {
if arg == globalDisablePagerFlag || arg == globalDisablePagerFlagShort {
globalPagerDisabled = true
}
}
Expand Down
Loading