Closed wxy closed 1 year ago
You can pipe to less
, if you use the -R
/--RAW-CONTROL-CHARS
option (or export LESS="-R"
):
export LESS="-R" # I suggest adding this to your shells RC file
hexyl … | less
Hello. It would be useful if hexyl
piped to less
automatically rather than requiring user to manually pipe.
I'd rather not implement paging by default, see https://github.com/sharkdp/hexyl/pull/30#issuecomment-453840276
I'd rather not implement paging by default, see #30 (comment)
I'd urge you to reconsider. Not sure what kind of pain it caused in bat
but most modern (after git
) CLI do this and it's very surprising when you try a very modern tool like hexyl and it doesn't do paging by default. I added colors and paging by default to gst-inspect
command 2 years ago and except for a few people, everyone was super thankful.
As long as there is an easy option to disable paging and colors, even the folks who don't want it will be fine. Your decision of course!
Re-opening this to see what others think.
This sounds like an appealing feature, but I'm not aware of what the drawbacks might be, and piping through less is pretty straightforward. What pain did this cause with bat?
I would also say the default behavior of --color
should probably be auto
, not always
, but maybe that's a discussion for another thread.
Not sure what kind of pain it caused in bat
What pain did this cause with bat?
If you want a taste of it, you can take a look at https://github.com/sharkdp/bat/issues/1053 :smile:. See the list of bug tickets in the first bullet point.
I would also say the default behavior of
--color
should probably beauto
, notalways
, but maybe that's a discussion for another thread.
All my other applications use "auto" by default. We decided to use "always" for hexyl, because (1) the defining feature of hexyl
is the colored output and (2) because it makes it much easier for users to pipe to less
.
If we decide to add automatic paging, we could certainly switch to "auto".
Not sure what kind of pain it caused in bat
What pain did this cause with bat?
If you want a taste of it, you can take a look at sharkdp/bat#1053 smile. See the list of bug tickets in the first bullet point.
I might be wrong but seems the majority of those issues are Windows-specific. IMHO it's a lot more important to provide a good user experience than portability across all OSes.
If we decide to add automatic paging, we could certainly switch to "auto".
:+1:
IMHO it's a lot more important to provide a good user experience than portability across all OSes.
as long as you are using one of the supported OSes? :smile:
Hi David,
I found this ticket by searching for 'pipe' in the list of issues.
I don't know how paging exactly relates to this but anyway: My use case is that I wanted to use hexyl <file> | rg foo
. This didn't work and instead I used xxd <file> | rg foo
.
If paging support would help my use case, then I would very much appreciate paging support.
@siedentop I don't think a lack of paging is related to your issue. Unix piping runs all processes at once, streaming the stdout between them - rather than waiting for the preceding one to finish, which could get blocked by a bad paging implementation, if that's what you were thinking. You haven't provided detail of what you're searching for (which may not work given the line wrapping of the output). But it could be the ANSI colour characters causing your trouble, as Hexyl does not automatically disable colour when piping - try --color=never
. If that's not it, you should open your own issue.
Thanks, @ZimbiX. If I use hexyl --color=never <file> | rg foo
it works. If I use --color=auto
it also works. So, maybe --color
should default to auto? (But that's been addressed by David above.)
I'm closing this due to inactivity. Please feel free to comment in case it should be re-opened.
While using it for large file, the output will scrolling long-long time , and piping to
more
will output bad string . So, please add pager to output .