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

Ability to write moar buffer to a file or to stdout #135

Open koraa opened 1 year ago

koraa commented 1 year ago

Hi thank you for writing this awesome tool!

I propose adding the ability to write the buffer to a file or stdout; this allows me not to have to think about whether I need to do do something with the output of a command and would greatly facilitate use cases such as paging every command through moar by default as a shell feature.

walles commented 1 year ago

You can already do echo hello | moar > hello.txt.

Is this what you want to do?

If not, an example of how you'd like this to work would help!

koraa commented 1 year ago

No, I am well aware of redirection. Its more like:

$ some_really_expensive_command | moar
$ some_really_expensive_command > myfile.txt # Shit I really should have written this to a file
walles commented 1 year ago

Right, so once inside of moar, you'd like to press some button, which would make moar save its buffer contents to a file?

koraa commented 1 year ago

Precisely.

walles commented 1 year ago

The title here says "or to stdout".

I can see the use case for sending to a file, but what about stdout?

Let's say I only did to file and not to stdout. Wouldn't that solve the whole use case of Shit I really should have written this to a file?

koraa commented 1 year ago

There would be some utility in user-in-the-loop data processing pipelines; opening multiple files and deciding which ones to process. Although if you write to a file, you can always write to "/dev/stdout"