walles / moar

Moar is a pager. It's designed to just do the right thing without any configuration.
Other
587 stars 17 forks source link

How can I make moar follow the output? #108

Closed ronny-rentner closed 1 year ago

ronny-rentner commented 1 year ago

When scrolled to the very bottom, I suggest that moar follows the output if new lines are added.

It would also be great if there was a cli option to start at the end of the file or stream in follow mode.

walles commented 1 year ago

No CLI option, but pressing down arrow before filling the first screen will make moar start following as soon as the first screen fills up.

walles commented 1 year ago

Please try this out and see if it works for you!

There are some limitations here, and I need to know whether or not you're running into those.

ronny-rentner commented 1 year ago

Thanks for the swift implementation. It works as expected but the missing CLI option is causing trouble.

I am using it like this:

unbuffer journalctl -fn 1000 |moar

I have a bash alias for this.

Not having a CLI option forces me to do an additional key press each time I want to see the journal and follow it.

I've tried somehow sending the End key to the moar process in addition from the bash alias but as I am already using a pipe this is not working, yet.

walles commented 1 year ago

Done: https://github.com/walles/moar/releases/tag/v1.11.1

ronny-rentner commented 1 year ago

Brilliant, thank you so much, it works like a charm.

The final bash alias I am using now is:

alias jcf='moar --follow < <(unbuffer journalctl -fe)'

In my opinion, this is a real USP for moar as no other pager I have tried can follow the output but also scroll up if you want. I've tried many different pagers including the classical more and less, but also most, batcat and the journalctl built in pager.

ronny-rentner commented 1 year ago

PS: I needed to use the above bash process substitution so pressing q in moar will also correctly end the journalctl process.

walles commented 1 year ago

Thank you for your kind words @ronny-rentner. I took the liberty of linking to your comment from the README.

ronny-rentner commented 1 year ago

Of course. For the interested reader, the unbuffer command is part of the expect package on Debian. It's needed to trick journalctl into giving us colors.