home-manager: respect NO_COLOR environment variable
This makes Home Manager respect the NO_COLOR environment variable to disable coloring from output generated by Home Manager. This initiative can be found more on https://no-color.org/
This commit is contained in:
parent
ddee030dc7
commit
69e2693342
|
@ -111,6 +111,9 @@ configure.packages.*.start -> programs.neovim.plugins = [ { plugin = ...; }]
|
|||
configure.customRC -> programs.neovim.extraConfig
|
||||
----
|
||||
|
||||
* Home Manager now respects the `NO_COLOR` environment variable as per
|
||||
https://no-color.org/[].
|
||||
|
||||
[[sec-release-21.05-state-version-changes]]
|
||||
=== State Version Changes
|
||||
|
||||
|
|
|
@ -221,7 +221,7 @@ function doSwitch() {
|
|||
function doListGens() {
|
||||
# Whether to colorize the generations output.
|
||||
local color="never"
|
||||
if [[ -t 1 ]]; then
|
||||
if [[ ! -v NO_COLOR && -t 1 ]]; then
|
||||
color="always"
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# The check for terminal output and color support is heavily inspired
|
||||
# by https://unix.stackexchange.com/a/10065.
|
||||
#
|
||||
# Allow opt out by respecting the `NO_COLOR` environment variable.
|
||||
|
||||
function setupColors() {
|
||||
normalColor=""
|
||||
|
@ -7,8 +9,8 @@ function setupColors() {
|
|||
warnColor=""
|
||||
noteColor=""
|
||||
|
||||
# Check if stdout is a terminal.
|
||||
if [[ -t 1 ]]; then
|
||||
# Enable colors for terminals, and allow opting out.
|
||||
if [[ ! -v NO_COLOR && -t 1 ]]; then
|
||||
# See if it supports colors.
|
||||
local ncolors
|
||||
ncolors=$(tput colors)
|
||||
|
|
|
@ -1873,6 +1873,13 @@ in
|
|||
'accounts.email.accounts.<name>.msmtp.enable' is true.
|
||||
'';
|
||||
}
|
||||
{
|
||||
time = "2021-03-03T22:16:05+00:00";
|
||||
message = ''
|
||||
Home Manager now respects the 'NO_COLOR' environment variable as per
|
||||
https://no-color.org/.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue