From 7d5d0f373dcbcc325b9e6e116d10fdd7f0b7ab98 Mon Sep 17 00:00:00 2001 From: Manuel Date: Mon, 23 Oct 2023 14:18:33 +0200 Subject: [PATCH] Honor the NO_COLOR environment variable (#1480) According to https://no-color.org/ --- src/alr/alr-commands.adb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/alr/alr-commands.adb b/src/alr/alr-commands.adb index 4fcbb3c6a..07b752835 100644 --- a/src/alr/alr-commands.adb +++ b/src/alr/alr-commands.adb @@ -161,7 +161,9 @@ package body Alr.Commands is Define_Switch (Config, No_Color'Access, Long_Switch => "--no-color", - Help => "Disables colors in output"); + Help => "Disables colors in output." + & " Default when NO_COLOR is defined in the" + & " environment."); Define_Switch (Config, No_TTY'Access, @@ -473,6 +475,7 @@ package body Alr.Commands is and then not No_Color and then not No_TTY and then Ada.Environment_Variables.Value ("TERM", "dumb") /= "dumb" + and then Ada.Environment_Variables.Value ("NO_COLOR", "") = "" then CLIC.TTY.Enable_Color (Force => False); -- This may still not enable color if TTY is detected to be incapable