p(1) - a lazy wrapper for $PAGER
p
p ...
p(1) is a lazy wrapper for $PAGER, which brings any pager a
similar functionality of the -F/--quit-if-one-screen option of
less(1).
When invoked as a piped pager (i.e. the standard input is not a terminal) without a file argument, it delays a pager invocation until it gets more lines than are displayable in the current terminal. The line number limit is estimated by subtracting two from the terminal's height to leave room for shell prompts.
If any argument is given or the standard input is a terminal, it
becomes eager enough to delegate everything to the pager. This means
calling p with a - (... | p -) always invokes the pager even if
it gets small input.
Lastly, if the standard output is not a terminal, it just passes the standard input through to the standard output without calling a pager.
-
PAGERThe command (or command line) wrapped around and invoked by this wrapper.
Copyright (c) 2012 Akinori MUSHA.
Licensed under the 2-clause BSD license. See LICENSE.txt for
details.
Visit GitHub Repository for the latest information.