Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display formatting not correct when used on PowerShell #178

Open
Liampor opened this issue Nov 23, 2021 · 5 comments
Open

Display formatting not correct when used on PowerShell #178

Liampor opened this issue Nov 23, 2021 · 5 comments
Labels

Comments

@Liampor
Copy link

Liampor commented Nov 23, 2021

Hello,

Problem

When I use TLDR on PowerShell, the output formatting is not correct, it looks like
image

Environment

PowerShell version 7.2.0
TLDR is installed via conda install tldr

$ tldr -v
>>> tldr 2.0.0 (Client Specification 1.4)

$ pip install tldr
>>> Requirement already satisfied: tldr in d:\tsusersoftware\miniconda3\lib\site-packages (2.0.0)
>>> Requirement already satisfied: argcomplete in d:\tsusersoftware\miniconda3\lib\site-packages (from tldr) (1.12.3)
>>> Requirement already satisfied: termcolor in d:\tsusersoftware\miniconda3\lib\site-packages (from tldr) (1.1.0)
>>> Requirement already satisfied: colorama in d:\tsusersoftware\miniconda3\lib\site-packages (from tldr) (0.4.4)

Others

TLDR works well on git-bash with the same installation and system

image

How could I fix it? Thank you all

@navarroaxel navarroaxel transferred this issue from tldr-pages/tldr Nov 23, 2021
@MasterOdin
Copy link
Collaborator

Are you able to change the following line:

colorama.init(strip=options.color)

to be:

    colorama.init(strip=options.color, convert=True)

and see if that fixes the problem?

@MasterOdin
Copy link
Collaborator

Alternatively, we may need to adjust it so that we do a from sys import stdout after calling colorama.init() to get it to work on Windows. I'm not totally sure, hopefully the convert thing above works as that's easier to manage.

@Liampor
Copy link
Author

Liampor commented Nov 23, 2021

Thanks, but I tried to modify the init-function and delete the local cache, but same issue again. 😂

Are you able to change the following line:

colorama.init(strip=options.color)

to be:

    colorama.init(strip=options.color, convert=True)

and see if that fixes the problem?

@Liampor
Copy link
Author

Liampor commented Nov 24, 2021

Update:
I have installed Fluent Terminal now and still use PowerShell 7.0 as Shell, then the tldr could work as expected.

image

@ImportTaste
Copy link

ImportTaste commented Dec 18, 2021

Until this is fixed, I came up with a little workaround that'll work on all consoles.

filter tldr {[String]::Join([Environment]::NewLine,( python -m tldr $Args ))}

You can also pipe to Write-Output for the same effect, but I felt it best to not involve a pipeline.

Question though, does tldr --help print out formatted text on Linux, like the npm version does? Or is this just something that was done for the Python client in general?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants