Inspired by the CLI Guidelines (https://clig.dev/#output); also, I always pipe ion beta inspect to less, but usually after I've forgotten to do that and blown away my terminal by trying to inspect a huge file.
This PR directs output to the pager specified by the PAGER environment variable, or less -FIRX if the environment variable is not set. Note: a pager is not used if the output is not a TTY.
less -FIRX has the following behavior:
does not page if the content fills one screen (i.e., for small streams, the behavior does not change)
ignores case when you search
enables color and formatting (which we don't currently use, but could)
leaves the contents on the screen when less quits
Currently a pager is not used on Windows because the pager crate appears to be Unix-only. It looks like there may be some pure Rust pager implementations that we could probably use instead. I liked this one because it allows users to bring their own pager. Before going deeper into this I wanted to open this PR for discussion.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Description of changes:
Inspired by the CLI Guidelines (https://clig.dev/#output); also, I always pipe
ion beta inspect
to less, but usually after I've forgotten to do that and blown away my terminal by trying to inspect a huge file.This PR directs output to the pager specified by the
PAGER
environment variable, orless -FIRX
if the environment variable is not set. Note: a pager is not used if the output is not a TTY.less -FIRX
has the following behavior:less
quitsCurrently a pager is not used on Windows because the
pager
crate appears to be Unix-only. It looks like there may be some pure Rust pager implementations that we could probably use instead. I liked this one because it allows users to bring their own pager. Before going deeper into this I wanted to open this PR for discussion.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.