feat: add support for NO_COLOR standard for controlling usage of colour in console messages#3859
Conversation
Signed-off-by: reubenmiller <reuben.d.miller@gmail.com>
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
Robot Results
|
Tested the NO_COLOR support and also could not get it to work
Signed-off-by: James Rhodes <jarhodes314@gmail.com>
@reubenmiller @albinsuresh I've now pushed a commit to ensure log lines respect the |
| tracing_subscriber::fmt() | ||
| .with_writer(std::io::stderr) | ||
| .with_ansi(std::io::stderr().is_terminal()) | ||
| .with_ansi(std::io::stderr().is_terminal() && yansi::Condition::no_color()) |
There was a problem hiding this comment.
I have been puzzled by the no_color() function name (I would expect something like no_no_color()), but that's correct.
albinsuresh
left a comment
There was a problem hiding this comment.
Re-tested with the fix from @jarhodes314 and it is working now.
rina23q
left a comment
There was a problem hiding this comment.
All tedge CLI commands seem fine.


Proposed changes
Add support to all tedge binaries to allow users to disable colours by setting the
NO_COLORvariable (e.g.export NO_COLOR=1) as per the no-color spec.This allows users who are on terminals which aren't capable of displaying colours to easily disable it by setting an environment variable in the shell profile.
The printing of terminal messages will be disabled when:
NO_COLORenvironment variable is set to anything butNO_COLOR=0Note: No tests were added as this feature is difficult to test as the test itself influences the result.
Types of changes
Paste Link to the issue
#3777
Checklist
just prepare-devonce)just formatas mentioned in CODING_GUIDELINESjust checkas mentioned in CODING_GUIDELINESFurther comments