From e1b7bd9c3a5be585815dc972a86a51cb1b63bfe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Wed, 10 Jul 2024 21:08:57 +0200 Subject: [PATCH] feat: Support `FORCE_COLOR` environment variable --- src/_griffe/cli.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/_griffe/cli.py b/src/_griffe/cli.py index 76ff14b5..6d5c932b 100644 --- a/src/_griffe/cli.py +++ b/src/_griffe/cli.py @@ -506,8 +506,11 @@ def check( # Find and display API breakages. breakages = list(find_breaking_changes(old_package, new_package)) + if color is None and (force_color := os.getenv("FORCE_COLOR", None)) is not None: + color = force_color.lower() in {"1", "true", "y", "yes", "on"} colorama.deinit() colorama.init(strip=color if color is None else not color) + if style is None: style = ExplanationStyle.VERBOSE if verbose else ExplanationStyle.ONE_LINE else: