Skip to content

feat: add --no-color flag with NO_COLOR env and auto-disable on non-TTY#16

Merged
sleipi merged 1 commit into
mainfrom
feat/no-color
May 19, 2026
Merged

feat: add --no-color flag with NO_COLOR env and auto-disable on non-TTY#16
sleipi merged 1 commit into
mainfrom
feat/no-color

Conversation

@sleipi
Copy link
Copy Markdown
Owner

@sleipi sleipi commented May 9, 2026

Summary

  • Adds --no-color CLI flag to disable ANSI color codes in output
  • Respects the NO_COLOR environment variable (no-color.org standard)
  • Auto-disables colors when stdout is not a TTY (piping/redirect)

Changes

File Change
internal/display/colors.go constvar, added DisableColors()
internal/display/colors_test.go Unit test for DisableColors()
cmd/clitest/root.go --no-color flag, NO_COLOR env check, non-TTY detection
test/e2e/options/it_disables_color_with_no_color_flag.clitest E2E tests for flag + env
SPEC.md Documented --no-color flag
ROADMAP.md Moved to Completed

Testing

make all passes — unit tests, lint, E2E, and examples all green.

…non-TTY

Disable ANSI color codes in output when:
- --no-color flag is set
- NO_COLOR environment variable is set (https://no-color.org/)
- stdout is not a TTY (piping/redirect)

Converts color constants to variables with a DisableColors() function.
Includes unit test, E2E tests, and updates to SPEC.md and ROADMAP.md.
@sleipi sleipi added the enhancement New feature or request label May 11, 2026
@sleipi sleipi merged commit be8895b into main May 19, 2026
2 checks passed
@sleipi sleipi deleted the feat/no-color branch May 19, 2026 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant