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

[feature request] Add command line color output for Windows #229

Open
skjerns opened this issue Dec 7, 2022 · 7 comments
Open

[feature request] Add command line color output for Windows #229

skjerns opened this issue Dec 7, 2022 · 7 comments

Comments

@skjerns
Copy link

skjerns commented Dec 7, 2022

As requested in #1 , it would be nice to have colored output also for Windows, which should be possible, even though not as easily as in unix.

I don't think I can currently implement it (as I'm also not using PySnooper very often).

@cool-RR
Copy link
Owner

cool-RR commented Dec 7, 2022

Cool, we'll wait for someone to volunteer to implement it. Note that it should be implemented without adding dependencies, so if we're using e.g. colorama, we'll need to copy-paste some of their code.

@cool-RR
Copy link
Owner

cool-RR commented Dec 7, 2022

If I remember correctly, the reason I didn't implement this when I implemented the same feature for Linux is that there are multiple shells you can run in Windows. (CMD, MSYS bash, Powershell, whatever Windows 10 has going on for running Linux.) I may have tried a solution on a couple of these and got inconsistent results. So figuring out a solution that works for all of these (or at least degrades gracefully) is the main difficulty here.

@cool-RR
Copy link
Owner

cool-RR commented Feb 6, 2023

The biggest priority in this feature is that whatever happens, we don't want to send an output with ugly shell escapes to a shell that won't interpret them correctly. That's the main disaster I'm trying to prevent.

@SonGokussj4
Copy link

Just found out about PySnooper and it's a lovely library. I'm on Windows (Windows Terminal) and it's a shape it doesn't have colors.
If you want to have some compatibility between shells, what about additional library like colorama or something like that?
Second idea is to have colors.conf and let the user specify possible changes?

@cool-RR
Copy link
Owner

cool-RR commented Apr 29, 2023

Thank you. My second message in this thread answers part of your message. In any case, if you want to implement this, go ahead.

@SonGokussj4
Copy link

Oh I apologize. I've skimmed through from 1st to 3rd and 4th message.

I see the code where you specify the colors. Will try to experiment a little bit. It's not my strong topic thought :-)
Anyway, have a great day.

P.S. Wouldn't it be possible to have something like like pip install pysnooper[colorama] which would be optional dependency or something like that? And then user can specify in pysnooper.conf if to use colorama or native shell escapes?

@cool-RR
Copy link
Owner

cool-RR commented Apr 29, 2023

P.S. Wouldn't it be possible to have something like like pip install pysnooper[colorama] which would be optional dependency or something like that? And then user can specify in pysnooper.conf if to use colorama or native shell escapes?

It would be possible, but it means that for the rest of PySnooper's life I will have to confirm that these two branches work with each new release. The less moving parts, the less maintenace work I have to do.

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

No branches or pull requests

3 participants