MCPcopy Create free account
hub / github.com/conforma/cli / setColorEnabled

Function setColorEnabled

internal/utils/helpers.go:144–155  ·  view source on GitHub ↗
(flagNoColor, flagForceColor bool)

Source from the content-addressed store, hash-verified

142}
143
144func setColorEnabled(flagNoColor, flagForceColor bool) bool {
145 if flagNoColor || anyEnvSet([]string{"EC_NO_COLOR", "EC_NO_COLOUR", "NO_COLOR", "NO_COLOUR"}) {
146 // Force no color
147 return false
148 }
149 if flagForceColor || anyEnvSet([]string{"EC_FORCE_COLOR", "EC_FORCE_COLOUR", "FORCE_COLOR", "FORCE_COLOUR"}) {
150 // Force color
151 return true
152 }
153 // Use color if we're in a terminal that can presumably display it
154 return isatty.IsTerminal(os.Stdout.Fd()) || isatty.IsCygwinTerminal(os.Stdout.Fd())
155}
156
157func anyEnvSet(varNames []string) bool {
158 for _, varName := range varNames {

Callers 1

SetColorEnabledFunction · 0.85

Calls 1

anyEnvSetFunction · 0.85

Tested by

no test coverage detected