Skip to content
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

logging: Generalize terminal color detection #9808

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

iamamyth
Copy link

Assume the terminal supports color codes if TERM ends with -color or -256color, rather than special-casing a handful of such terminals.

Add tests for terminal color detection.

Assume the terminal supports color codes if TERM ends with `-color` or
`-256color`, rather than special-casing a handful of such terminals.

Add tests for terminal color detection.
@iamamyth
Copy link
Author

@selsta Per discussion in #9772.

@laanwj
Copy link
Contributor

laanwj commented Feb 20, 2025

Changes LGTM. Thanks!

@@ -1211,6 +1211,8 @@ class OS : base::StaticClass {
/// @detail For android systems this is device name with its manufacturer and model seperated by hyphen
static std::string currentHost(void);
/// @brief Whether or not terminal supports colors
static bool termSupportsColor(std::string& term);
/// @brief Whether or not terminal supports colors
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps you can clarify this to something along the lines of "the terminal attached to this environment", and change the previous to "a terminal with this name"

@jeffro256
Copy link
Contributor

I would at least make @laanwj co-author on this PR as a sign of good faith since her code on this commit d588a99 is similar style-wise in it's approach and has equivalent behavior. Also, she brought up the issue initially.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants