Open genivia-inc opened 9 months ago
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.
@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).
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.
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.