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

NO_COLOR and empty string value #172

Closed
pellared opened this issue Nov 13, 2022 · 0 comments · Fixed by #171
Closed

NO_COLOR and empty string value #172

pellared opened this issue Nov 13, 2022 · 0 comments · Fixed by #171

Comments

@pellared
Copy link
Contributor

The https://no-color.org/ requires handling empty value in way as if the value was not set.

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

I find it a lot better for several reasons.

The problem is that not all languages/OSes/shells are handling an empty value in the same way.

In .NET (C# etc) setting an empty value unsets the environmental variable (sic!). See: https://docs.microsoft.com/en-us/dotnet/api/system.environment.setenvironmentvariable?view=net-5.0

On Windows setting an empty env var is VERY tricky. I suspect 95% of Windows IT users may have real problems doing it. You cannot do it in the command prompt. not via PowerShell, not via GUI. It is possible via Windows Registry or WinAPI, but it is VERY inconvenient and hacky.

Also from a pure usability point of view, echo $SOMEVAR does not allow to distinguish between empty and unset.

Having a different interpretation of an empty and unset environment variable can be seen as a kind of "billion-dollar mistake" 😉

Reference: https://unix.stackexchange.com/questions/27708/is-there-a-difference-between-setting-an-environment-variable-to-the-empty-strin

At last, many software see empty env vars as though as it they are not set e.g. https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/sdk-environment-variables.md#parsing-empty-value

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 a pull request may close this issue.

1 participant