Skip to content

Respect NO_COLOR in the auto color mode - #170

Merged
peso merged 1 commit into
git-bahn:masterfrom
mateuscmtropical:feat/no-color-env
Nov 22, 2026
Merged

peso merged 1 commit into
git-bahn:masterfrom
mateuscmtropical:feat/no-color-env

Conversation

@mateuscmtropical

Copy link
Copy Markdown
Contributor

Closes #169

The auto color mode, which is also the default, now prints no colors when NO_COLOR is set to a non-empty value, as https://no-color.org/ describes. --color always still prints colors, since a command line option overrides the variable.

  • auto_color() holds the old auto check plus the NO_COLOR check, and both auto paths use it.
  • --color help, docs/manual.md and the CHANGELOG mention it.
  • Unit test for the non-empty rule.

Checked with the built binary in a pseudo terminal (script): NO_COLOR=1 gives no escape codes by default and with --color auto, NO_COLOR= (empty) keeps colors, and NO_COLOR=1 --color always keeps colors. cargo fmt --check, cargo clippy --all --all-targets and cargo test --all pass.

@peso
peso merged commit 58ed7b3 into git-bahn:master Nov 22, 2026
7 checks passed
@peso

peso commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

Thank you for the contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support NO_COLOR flag

2 participants