Skip to content

Commit

Permalink
Honor the NO_COLOR environment variable (alire-project#1480)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrojo authored Oct 23, 2023
1 parent 8c2a380 commit 7d5d0f3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/alr/alr-commands.adb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7d5d0f3

Please sign in to comment.