diff options
| author | Carl Ã…stholm <carl@astholm.se> | 2024-06-02 18:11:16 +0200 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-06-02 17:35:34 -0400 |
| commit | d74180c373274bc545992c2a96a8e7618f8bd52c (patch) | |
| tree | b8188915feaecc6596d816455a96dcc78e6b653d /src/main.zig | |
| parent | 85eb5a3069c132388191e9531802ccfd993737f1 (diff) | |
| download | zig-d74180c373274bc545992c2a96a8e7618f8bd52c.tar.gz zig-d74180c373274bc545992c2a96a8e7618f8bd52c.zip | |
Replace YES_COLOR with CLICOLOR_FORCE
Instead of introducing YES_COLOR, a completely new standard, into the mix
it might make more sense to instead tag along with the CLICOLOR_FORCE env var,
which dates back to at least 2000 with FreeBSD 4.1.1 and which is
supported by tools like CMake.
<https://bixense.com/clicolors/>
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main.zig b/src/main.zig index 7e00b8c058..21f7281d74 100644 --- a/src/main.zig +++ b/src/main.zig @@ -994,11 +994,16 @@ fn buildOutputType( .native_system_include_paths = &.{}, }; - // before arg parsing, check for the NO_COLOR environment variable - // if it exists, default the color setting to .off + // before arg parsing, check for the NO_COLOR and CLICOLOR_FORCE environment variables + // if set, default the color setting to .off or .on, respectively // explicit --color arguments will still override this setting. // Disable color on WASI per https://github.com/WebAssembly/WASI/issues/162 - var color: Color = if (native_os == .wasi or EnvVar.NO_COLOR.isSet()) .off else .auto; + var color: Color = if (native_os == .wasi or EnvVar.NO_COLOR.isSet()) + .off + else if (EnvVar.CLICOLOR_FORCE.isSet()) + .on + else + .auto; switch (arg_mode) { .build, .translate_c, .zig_test, .run => { |
