diff --git a/pyproject.toml b/pyproject.toml index a8815ea..7fd7ac7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,7 +48,7 @@ classifiers = [ "Topic :: Utilities", ] dependencies = [ - "colorama; sys_platform=='win32'", + "colorama==0.4.6; sys_platform=='win32'", "shtab>=1.3.10", "termcolor", ] diff --git a/requirements.txt b/requirements.txt index a9946f7..e2fbac1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ termcolor -colorama==0.4.6 +colorama==0.4.6; sys_platform=='win32' shtab>=1.3.10 diff --git a/tldr.py b/tldr.py index 02456a3..96529b2 100755 --- a/tldr.py +++ b/tldr.py @@ -682,6 +682,7 @@ def main() -> None: display_option_length = "long" if options.short_options and options.long_options: display_option_length = "both" + if sys.platform == "win32": import colorama colorama.init(strip=options.color) @@ -744,6 +745,17 @@ def main() -> None: ).format(cmd=command)) else: output(results[0][0], display_option_length, plain=options.markdown) + + if results[0][1] not in (get_platform(), "common") and not options.platform: + warning_suffix = ( + f": showing page from platform '{results[0][1]}', " + f"because '{command}' does not exist in '{get_platform()}' and 'common'." + ) + if options.markdown: + print(f"warning{warning_suffix}") + else: + print(f"{colored('warning', 'yellow')}{warning_suffix}") + if results[1:]: platforms_str = [result[1] for result in results[1:]] are_multiple_platforms = len(platforms_str) > 1