Honor no_color config and add a global --color flag #173
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/171-color-control"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #171.
fj config set no_color truewas accepted (no_coloris inKNOWN_KEYS) but read nowhere: color was decided solely by the supports-color crate (isatty plusNO_COLOR/FORCE_COLOR), so the documented setting was a silent no-op and there was no per-invocation override.What changed:
--color <auto|always|never>flag.alwaysforces color on (e.g. intoless -R),neverstrips it,autokeeps today's terminal detection. It isglobal = true, so it works on every command.no_colorconfig key now feeds the decision viaconfig::no_color_enabled, parsed leniently (1/true/yes/on).output::supports_colorroutes through a single resolver (supports_color_with) that applies the precedence; the env / config / tty inputs are injected so the resolver is unit-tested directly.Precedence, highest first:
--colorflag >NO_COLOR/FORCE_COLORenv >no_colorconfig > terminal detection. Documented in the README, the FAQ, and the gh-to-fj map.Tests: the precedence resolver is covered across the flag / env / config / tty matrix, including a guard that
no_color=truesuppresses color. Full suite green (536 passing), clippy-D warningsclean,cargo fmt --checkclean.Honor color controlsto Honor no_color config and add a global --color flag