bids-standard / legacy-validator

Validator for the Brain Imaging Data Structure
https://bids-standard.github.io/legacy-validator/
MIT License
186 stars 111 forks source link

feat(cli): Detect color support, respect flags and environment variables #2068

Closed effigies closed 3 months ago

effigies commented 3 months ago

This PR adds --color/--no-color flags to let users enable/disable ANSI colors. The default value depends on whether it's a terminal and whether FORCE_COLOR is set. If NO_COLOR is set, that overrides all coloring, since that is enforced by Deno.

Precedence: NO_COLOR > flag > FORCE_COLOR > isTerminal().

IMO, the only question is what to do if FORCE_COLOR=1 bids-validator --no-color. I chose to respect the flag over the environment variable.

Closes #1997.

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 87.14%. Comparing base (1453bc1) to head (093e835). Report is 2 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2068 +/- ## ========================================== + Coverage 85.75% 87.14% +1.38% ========================================== Files 91 139 +48 Lines 3785 6682 +2897 Branches 1218 1572 +354 ========================================== + Hits 3246 5823 +2577 - Misses 453 769 +316 - Partials 86 90 +4 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.