Skip to content

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

@augustoproiete

Description

@augustoproiete

In #2975 we introduced a way to opt-out of ANSI coloring by setting an environment variable (NO_COLOR).

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 <value>
  • 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.

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions