crate-ci / typos

Source code spell checker
Apache License 2.0
2.69k stars 112 forks source link

Support FORCE_COLOR / NO_COLOR env vars #1141

Open mjpieters opened 3 weeks ago

mjpieters commented 3 weeks ago

Please support the FORCE_COLOR and NO_COLOR environment variables as alternative to the--color CLI switch.

The start-up behaviour then would be:

  1. --color set: use this configuration.
  2. NO_COLOR set: treat as --color never
  3. FORCE_COLOR set: treat as --color always
  4. use the default --color auto.

I see typos uses anstyle, like uv, so this is a virtual duplicate of astral-sh/uv#3955, with NO_COLOR already working, and CLICOLOR_FORCE having the same effect as FORCE_COLOR.

epage commented 3 weeks ago

This is blocked on rust-cli/anstyle#192 as I'm not going to move forward like uv did in astral-sh/uv#3979 due to all of the open question related to FORCE_COLOR (see donatj/force-color.org#30). However, this shouldn't be blocking because CLICOLOR_FORCE exists.

mjpieters commented 3 weeks ago

My PR interprets FORCE_COLOR the same way CLICOLOR_FORCE is interpreted: as non-empty.