38 lines
1.2 KiB
Diff
38 lines
1.2 KiB
Diff
From b391bcaf11f142135f549c1a69fd0c1560f3cff3 Mon Sep 17 00:00:00 2001
|
|
From: Matthew Peveler <matt.peveler@gmail.com>
|
|
Date: Tue, 27 Dec 2022 09:48:42 -0500
|
|
Subject: [PATCH] Fix forcing color through termcolor (#204)
|
|
|
|
---
|
|
tests/test_tldr.py | 3 ++-
|
|
tldr.py | 2 ++
|
|
2 files changed, 4 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/tests/test_tldr.py b/tests/test_tldr.py
|
|
index 0ed0dd1..b49c3ed 100644
|
|
--- a/tests/test_tldr.py
|
|
+++ b/tests/test_tldr.py
|
|
@@ -12,7 +12,8 @@
|
|
|
|
|
|
@pytest.mark.parametrize("page_name", page_names)
|
|
-def test_whole_page(page_name):
|
|
+def test_whole_page(page_name, monkeypatch):
|
|
+ monkeypatch.setenv("FORCE_COLOR", "1")
|
|
with open(f"tests/data/{page_name}.md", "rb") as f_original:
|
|
with open(f"tests/data/{page_name}_rendered", "rb") as f_rendered:
|
|
old_stdout = sys.stdout
|
|
diff --git a/tldr.py b/tldr.py
|
|
index 7e96807..1ac6c39 100755
|
|
--- a/tldr.py
|
|
+++ b/tldr.py
|
|
@@ -493,6 +493,8 @@ def main() -> None:
|
|
options = parser.parse_args()
|
|
|
|
colorama.init(strip=options.color)
|
|
+ if options.color is False:
|
|
+ os.environ["FORCE_COLOR"] = "true"
|
|
|
|
if options.update_cache:
|
|
update_cache(language=options.language)
|