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

Honor the NO_COLOR environment variable #1480

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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