🚀 Enhancements
fix: provenance and syntax highlighting respect --no-color and pipe detection @osterman (#2281)
## what- Provenance output (
describe component --provenance) now strips ANSI color codes when stdout is piped or redirected, and respects--no-color - Syntax highlighting via
HighlightCodeWithConfigalso properly degrades when stdout is piped - Provenance output now routes through
data.Write()instead offmt.Print()for proper I/O channel handling
why
- Provenance rendering used
lipgloss.NewStyle()unconditionally without checking stdout TTY status, so ANSI escape codes leaked into piped/redirected output HighlightCodeWithConfigcheckedIsTTYSupportForStdout() || IsTTYSupportForStderr()— since stderr remains a TTY when piping stdout, this always returned true and defeated pipe detectionfmt.Print()bypassed the data channel I/O layer, skipping secret masking
references
- Follows the same stdout-only TTY check pattern used by list commands (
pkg/list/list_values.go) - Mirrors
HighlightCodeWithConfig's precedence:NoColorwins, thenForceColor, then stdout TTY detection
Summary by CodeRabbit
-
Improvements
- More precise color handling for provenance and code highlighting: honors NoColor/ForceColor and now detects stdout TTY only for consistent styling.
- Provenance rendering disables styling when color is off.
- Provenance stdout output now flows through the shared output path for more consistent display.
-
Bug Fixes
- Normalized spacing and newline placement around provenance legends and stack headers.
-
Tests
- Updated/added tests and golden snapshots to reflect whitespace, legend formatting, and color/no-color behaviors.