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

Specify standard input with - (dash) #162

Open
genivia-inc opened this issue Oct 8, 2023 · 3 comments
Open

Specify standard input with - (dash) #162

genivia-inc opened this issue Oct 8, 2023 · 3 comments

Comments

@genivia-inc
Copy link

Most *nix utilities support argument - to specify that standard input should be read.

This is useful for several reasons, such as when standard input should be processed together with other files or for automation with a bash script that takes a file argument to invoke moar in the script on that argument, so that - also works for those cases.

@walles
Copy link
Owner

walles commented Oct 11, 2023

when standard input should be processed together with other files

moar just accepts one file argument, and I don't see that changing any time soon.

a bash script that takes a file argument to invoke moar in the script on that argument

Sounds like a wrapper script of some kind.

If you have one of these, can you share it?

If moar needs a wrapper script then I'd like to at least consider moving whatever functionality that script provides into moar proper.

@genivia-inc
Copy link
Author

@walles even when moar takes one argument only, it is standard in the *nix world to interpret - as standard input. It is useful in scripts too, so one does not need to edit the moar arguments when it takes $FILE when we can set $FILE to -, for example (e.g. testing etc).

@genivia-inc
Copy link
Author

I've included moar as a recognizable pager in ugrep with argument + to jump to a line number. Since I want to let ugrep display any contents, including the contents of files compressed in zip archives, I need to invoke moar to display standard input. It works fine in my dev version without specifying a file argument to moar, but the logic to do this is more involved with branches than just setting the file argument to - which looks a lot cleaner in the source code.

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