cake-build / cake-build/cake

Add support for opting out of ANSI coloring via command-line switch & cake.config

Open
#3,138 3 comments 0 reactions 1 assignee Claimed by @augustoproiete View on GitHub
Improvement
Dominant language
C#
Stars
4.2k
Forks
778
Avg merge
1h 15m
Merged PRs (30d)
19

Description

In #2975 we introduced a way to opt-out of ANSI coloring by setting an environment variable ([`NO_COLOR`](https://no-color.org)).

This issue is about introducing two more alternative ways to opt-out of ANSI coloring:

1. Via a new command-line switch e.g. `--no-color` and/or `--settings_color=never`

2. Via a configuration setting in cake.config

---

For the configuration options, I suggest adding a new configuration value under `Settings` called `Color`, which can be one of the following values:

- **`auto`** - Let AnsiDetector decide if color is supported or not based on environment (**_default_**)
- **`never`** - **opt out** of coloring, regardless of environment (_skip_ the logic to detect if color is supported or not)
- **`always`** - **opt in** on coloring, regardless of environment (_skip_ the logic to detect if color is supported or not)

The `color` option would be available as ...
- An argument passed into Cake: `--settings_color `
- A configuration file value: `Color=value` (under the `Settings` section)
- An environment variable: `CAKE_SETTINGS_COLOR=value`

... and follow the [same priority order as other configuration values](https://cakebuild.net/docs/running-builds/configuration/set-configuration-values).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.