-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support FORCE_COLOR
env var
#5499
Comments
We use We could either manually set the override when |
Happy to move to a different crate, no objection from me. |
This would be a nice feature to have. I have had good experiences with using |
Fixes astral-sh#5499 ## Summary Add support for `FORCE_COLOR` env var, as specified at https://force-color.org/ ## Test Plan I wrote an integration test for this, and then realized that can't work, since we use a dev-dependency on `colored` with the `no-color` feature to avoid ANSI color codes in test snapshots. So this is just tested manually. `cargo run --features test-rules -- check --no-cache --isolated - --select RUF901 --diff < /dev/null` shows a colored diff. `cargo run --features test-rules -- check --no-cache --isolated - --select RUF901 --diff < /dev/null | less` does not have color, since we pipe it to `less`. `FORCE_COLOR=1 cargo run --features test-rules -- check --no-cache --isolated - --select RUF901 --diff < /dev/null | less` does have color (after this diff), even though we pipe it to `less`.
Feature Request
Add support for the
FORCE_COLOR
environment variable. When set, regardless of value, all output should have colors enabled, as if the terminal supported them.As far as I can tell, Ruff does support a similar environment variable,
CLICOLOR_FORCE
.It seems to me, though, that
FORCE_COLOR
is a lot more common.In my opinion, it'd be worth supporting both.
Some projects that use this:
Related:
FORCE_COLOR
env var python-poetry/cleo#341FORCE_COLOR
env var pre-commit/pre-commit#2918The text was updated successfully, but these errors were encountered: