tigrawap/slit

Add -f option to follow stdin or file updates

Closed this issue · 3 comments

First off just wanted to say I've been using slit for a while now and think it's awesome. I have a couple of questions though.

I was wondering about slit's live paging features in the future, namely if you've got any plans to page changing output piped from stdout so something like tail -f errors.log | slit could be attainable, for example. To be honest I'm not even sure if that's possible since even less seems unable to comfortably do it.

For the time being I'm working around that limitation by redirecting stdout to a file and then passing that file to slit. This seems to do the trick quite nicely with a caveat: if I add a filter whilst viewing a live file, slit won't add new suitable lines to the filtered-out view. Is this something you'd consider doing in the future?

Thanks for feedback :)

I am definitely going to add -f option, that will follow files and stdin, although, can't give time estimate yet.

Meanwhile, what you can do is shift+g (go to end)
Sometimes it is enough, it will apply all filters to new content

This will load everything new it got. Both from stdin and file
so you can slit errors.log and then shift+G whenever you want to see updates

Aha! Shift+g does certainly seem to do the trick, thanks! Looking forward to a built-in "follow" feature, whenever that may come :)

Added -f option

Will follow both stdin/file
Navigating from the end will abort following, return to the end will resume following

Two caveats

  • It might be somehow inefficient if pouring a lot of data to updated file and only one line out of very very many should be displayed
  • It's file polling once in 100 ms. Still not file events
    Will work on both later, but, for most cases it is much better than nothing