Skip to content

Commit e5de29e

Browse files
committed
Expose IsColorForced
Since IsColorDisabled - based on env vars - is public, also expose IsColorForced so the gamut of GitHub CLI env vars for color overrides are available to callers.
1 parent 026e976 commit e5de29e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/term/env.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func FromEnv() Term {
5252
}
5353
} else {
5454
stdoutIsTTY = IsTerminal(os.Stdout)
55-
isColorEnabled = envColorForced() || (!IsColorDisabled() && stdoutIsTTY)
55+
isColorEnabled = IsColorForced() || (!IsColorDisabled() && stdoutIsTTY)
5656
}
5757

5858
isVirtualTerminal := false
@@ -162,7 +162,8 @@ func IsColorDisabled() bool {
162162
return os.Getenv("NO_COLOR") != "" || os.Getenv("CLICOLOR") == "0"
163163
}
164164

165-
func envColorForced() bool {
165+
// IsColorForced returns true if environment variable CLICOLOR_FORCE is set to force colored terminal output.
166+
func IsColorForced() bool {
166167
return os.Getenv("CLICOLOR_FORCE") != "" && os.Getenv("CLICOLOR_FORCE") != "0"
167168
}
168169

0 commit comments

Comments
 (0)