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

How can I make moar follow the output? #108

Closed
ronny-rentner opened this issue Nov 24, 2022 · 8 comments
Closed

How can I make moar follow the output? #108

ronny-rentner opened this issue Nov 24, 2022 · 8 comments

Comments

@ronny-rentner
Copy link

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.

@ronny-rentner ronny-rentner changed the title How can I make moar follow the output How can I make moar follow the output? Nov 24, 2022
@walles walles closed this as completed in 1b0a214 Nov 26, 2022
@walles
Copy link
Owner

walles commented Nov 26, 2022

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
Copy link
Owner

walles commented Nov 27, 2022

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
Copy link
Author

ronny-rentner commented Nov 28, 2022

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 added a commit that referenced this issue Nov 28, 2022
@walles
Copy link
Owner

walles commented Nov 28, 2022

@ronny-rentner
Copy link
Author

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
Copy link
Author

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

walles added a commit that referenced this issue Nov 30, 2022
@walles
Copy link
Owner

walles commented Nov 30, 2022

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

@ronny-rentner
Copy link
Author

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.

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

2 participants