Skip to content

Add support for NO_COLOR environment variable - #1207

Closed
AbstractBeliefs wants to merge 1 commit into
ggreer:masterfrom
AbstractBeliefs:no-colour-env
Closed

Add support for NO_COLOR environment variable#1207
AbstractBeliefs wants to merge 1 commit into
ggreer:masterfrom
AbstractBeliefs:no-colour-env

Conversation

@AbstractBeliefs

Copy link
Copy Markdown

When the NO_COLOR environment variable is present (with any value), disable
colour output. This can be overrident explicitly with the --color switch.

See also: http://no-color.org/

When the NO_COLOR environment variable is present (with any value), disable
colour output. This can be overrident explicitly with the `--color` switch.

See also: http://no-color.org/
@AbstractBeliefs

AbstractBeliefs commented Jan 26, 2018

Copy link
Copy Markdown
Author

There's unfortunately no test for this: the test environment has colour suppression due to the tty detection, and because of this all colour tests have the --color switch, overriding the environment variable.

A test could be implemented by removing the --color switch and disabling tty detection with another new switch, but I'm not sure this is a helpful path to go down.

@ggreer ggreer closed this Jun 7, 2018
@ggreer

ggreer commented Jun 7, 2018

Copy link
Copy Markdown
Owner

I don't mean to annoy you by closing this. It's just that we seem to disagree on the usefulness of this feature. People can read my reasons here: https://news.ycombinator.com/item?id=17244313

Sorry.

@kikonen

kikonen commented Jun 1, 2022

Copy link
Copy Markdown

I surely would have liked that also this tool would have simply conformed to NO_COLOR, instead of needing to extra tricks for this case :()

Thus

alias ag="ag --nocolor"

it is

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.

3 participants