hexyl icon indicating copy to clipboard operation
hexyl copied to clipboard

Automatic paging?

Open wxy opened this issue 5 years ago • 12 comments

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 .

wxy avatar Jan 14 '19 10:01 wxy

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

sharkdp avatar Jan 14 '19 19:01 sharkdp

Hello. It would be useful if hexyl piped to less automatically rather than requiring user to manually pipe.

jamadagni avatar Apr 27 '19 06:04 jamadagni

I'd rather not implement paging by default, see https://github.com/sharkdp/hexyl/pull/30#issuecomment-453840276

sharkdp avatar Apr 27 '19 09:04 sharkdp

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!

zeenix avatar Jul 26 '20 17:07 zeenix

Re-opening this to see what others think.

sharkdp avatar Jul 26 '20 20:07 sharkdp

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.

ghost avatar Jul 27 '20 03:07 ghost

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 be auto, not always, 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".

sharkdp avatar Aug 01 '20 21:08 sharkdp

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:

zeenix avatar Aug 03 '20 10:08 zeenix

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:

sharkdp avatar Aug 03 '20 12:08 sharkdp

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 avatar Mar 23 '22 05:03 siedentop

@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.

ZimbiX avatar Mar 23 '22 06:03 ZimbiX

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.)

siedentop avatar Mar 23 '22 17:03 siedentop

I'm closing this due to inactivity. Please feel free to comment in case it should be re-opened.

sharkdp avatar Dec 05 '22 20:12 sharkdp