tldr-pages / tldr-python-client

Python command-line client for tldr pages
https://pypi.org/project/tldr/
MIT License
596 stars 93 forks source link

Improved output handling on Windows #196

Closed God-damnit-all closed 6 months ago

God-damnit-all commented 2 years ago

Uses the Windows API to set the ENABLE_VIRTUAL_TERMINAL_PROCESSING flag for proper ANSI code handling, based off discussion from https://stackoverflow.com/questions/36760127

Also sets convert=True in the colorama initialization. This seems to improve compatibility when redirecting/piping output, particularly for line breaks.

(PowerShell 7+ Note: When piping the output of tldr.py, you should have $PSStyle.OutputRendering set to ANSI if you want colors to display.)

Fixes #178