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

Force no color output if NO_COLOR environment variable is set #2187

Merged
merged 1 commit into from
Nov 16, 2024

Conversation

narqo
Copy link
Contributor

@narqo narqo commented Nov 6, 2024

Closes #2150

This PR updates the cmd to default to the no colors mode if the NO_COLOR environment variable is set. This is to follow the informal standard https://no-color.org/ that states:

Command-line software which adds ANSI color to its output by default should check for a NO_COLOR environment variable that, when present and not an empty string (regardless of its value), prevents the addition of ANSI color.

Note that the user's CLI flags still override the default behaviour, as per the following:

User-level configuration files and per-instance command-line arguments should override the NO_COLOR environment variable. A user should be able to export NO_COLOR=1 in their shell configuration file as a default, but configure a specific program in its configuration file to specifically enable color.

@mikefarah mikefarah merged commit f071a25 into mikefarah:master Nov 16, 2024
2 of 3 checks passed
@narqo narqo deleted the no-color branch November 16, 2024 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: NO_COLOR standard implementation
2 participants