-
-
Notifications
You must be signed in to change notification settings - Fork 233
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
Add --color flag to disable ANSI sequences #30
Add --color flag to disable ANSI sequences #30
Conversation
8eaa9cb
to
723db2d
Compare
Note that this breaks a common use case, of redirecting |
If color codes were not emitted through pipes by default, that use-case could be restored by requiring a |
@bennetthardwick Thank you very much for your contribution!
True. Adding a
if they wanted to use a pager. To solve this, we could think about adding a For now, I'd say we merge this and add a |
There's also an env var named |
If you don't want color, why use |
I fully agree. But what if somebody was looking at the colored output and now wants to write that to a file or use |
The problem is piping to |
Okay, I tend to agree. @bennetthardwick what do you think? |
It depends on how far are you going to extend hexyl. Is it going to be just a simple colorized hd? If so, there's no reason to not use hd when colors are not needed (and the user can use But if there's a plan for anything that hd can't do, then piping definitely should be supported, and in such case you'd want consistency with other programs. I mean, if for example you'd implement #6, it'd be something useful even without color. So it's about how many features you plan for. |
We could add a |
I agree with @kballard, if there's an existing use case that's quite popular it wouldn't be great to break it. |
723db2d
to
43b20cd
Compare
That sounds very good to me. If you want to work on this, please amend this PR. If not, feel free to say so and somebody else can continue working on this. In any case, thank you very much! |
43b20cd
to
0c232b5
Compare
Sweet! I've updated the PR to use the |
Thank you very much! I have updated the PR to use alias hexyl="hexyl --color=auto" if they want the TTY-detection behavior. |
When printing the output of hexyl to a file (
hexyl file.exe > file.txt
), thefile.txt
file gets polluted by the ANSI escape sequences. Checking whether the application has been launched from inside the terminal or not, allows you to decide whether or not to use them.I don't have access to a Windows machine, but atty claims that it has been tested on Windows.