MCPcopy
hub / github.com/docker/compose / shouldDisableAnsi

Function shouldDisableAnsi

cmd/compose/hooks.go:61–69  ·  view source on GitHub ↗

shouldDisableAnsi checks whether ANSI escape sequences should be explicitly suppressed via environment variables. The hook runs as a separate subprocess where the normal PersistentPreRunE (which calls formatter.SetANSIMode) is skipped, so we check NO_COLOR and COMPOSE_ANSI directly. TTY detection i

()

Source from the content-addressed store, hash-verified

59// PrintNextSteps (which itself emits bold ANSI unconditionally). The hook
60// subprocess cannot reliably detect whether the parent's output is a terminal.
61func shouldDisableAnsi() bool {
62 if noColor, ok := os.LookupEnv("NO_COLOR"); ok && noColor != "" {
63 return true
64 }
65 if v, ok := os.LookupEnv("COMPOSE_ANSI"); ok && v == formatter.Never {
66 return true
67 }
68 return false
69}
70
71type hookHint struct {
72 template func(appID string) string

Callers 1

hintLinkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected