I think it's fairly common.
NO_COLOR=1
NO_COLOR=true
NO_COLOR=yes
Rather than parsing all the permutations, the usual evaluation of env vars that are expected to hold a boolean type is just the equivalent of: #ifdef NO_COLORWell, in ZSH [[ -v VAR ]] can actually differentiate between unset and null variables
And
NO_COLOR=
would lead to an non-intuitive behavior
I think the implication is that it should have a value.
Re:No_color
by chrisseaton on Saturday February 26, 2022 @07:50PM
(#30484056)
> That is, the presence of the env var regardless of its value trips the conditional ?
Pretty normal, yeah. You can `unset FOO` a variable to set it to false.
"... should check for the presence of a NO_COLOR environment variable that, when present (regardless of its value), prevents the addition of ANSI color ..."
How common is this behavior ?
That is, the presence of the env var regardless of its value trips the conditional ?
That seems like asking for trouble / confusion ... especially since there is a very well understood practice of setting 0/1 false/true for settings like this.
Is this commonly done and I have just never noticed it ?