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

fix: display color when NO_COLOR is an empty string #1421

Merged
merged 1 commit into from
Nov 7, 2023

Conversation

acuteenvy
Copy link
Contributor

Same as sharkdp/bat#2767.

@acuteenvy acuteenvy changed the title fix: display color when NO_COLOR is an empty string fix: display color when NO_COLOR is an empty string Nov 4, 2023
tavianator added a commit to tavianator/bfs that referenced this pull request Nov 6, 2023
The docs say

> 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.

but we were not checking for the empty string.

Link: https://no-color.org/
Link: sharkdp/fd#1421
@tavianator tavianator merged commit d62bbbb into sharkdp:master Nov 7, 2023
15 checks passed
@tavianator
Copy link
Collaborator

Hmm I just realized after merging this that we should add a test. Do you feel like doing that @acuteenvy?

@acuteenvy
Copy link
Contributor Author

I can't seem to get fd to output color in tests at all, unless I pass --color=always which makes the test pointless.

@acuteenvy acuteenvy deleted the fix-no-color branch November 8, 2023 19:53
@tmccombs
Copy link
Collaborator

tmccombs commented Nov 9, 2023

It would be possible to write a test, at least on linux. But it would require working with a pty, which would be fairly involved.

@tavianator
Copy link
Collaborator

Right yeah, I don't think it's worth the effort

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