Skip to content

Commit 56f7d2b

Browse files
committed
Try to force color in CI envs
1 parent a8865fe commit 56f7d2b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

plain/plain/cli/formatting.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
13
import click
24
from click.formatting import iter_rows, measure_table, term_len, wrap_text
35

@@ -59,3 +61,13 @@ def write_dl(
5961

6062
class PlainContext(click.Context):
6163
formatter_class = PlainHelpFormatter
64+
65+
def __init__(self, *args, **kwargs):
66+
super().__init__(*args, **kwargs)
67+
68+
# Force colors in CI environments
69+
if any(
70+
os.getenv(var)
71+
for var in ["CI", "FORCE_COLOR", "GITHUB_ACTIONS", "GITLAB_CI"]
72+
):
73+
self.color = True

0 commit comments

Comments
 (0)