minus
A fast, asynchronous terminal paging library for Rust. minus provides high
level functionalities to easily write a pager for any terminal application. Due
to the asynchronous nature of minus, the pager's data can be updated.

minus supports both tokio as well as async-std runtimes. What's more,
if you only want to use minus for serving static output, you can simply opt
out of these dynamic features, see the Usage section below.
Why this crate ?
minus was started by me for my work on pijul. I was unsatisfied with the
existing options like pager and moins.
-
pager:- Only provides functions to join the standard output of the current
program to the standard input of external pager like
moreorless. - Due to this, to work within Windows, the external pagers need to be packaged along with the executable.
- Only provides functions to join the standard output of the current
program to the standard input of external pager like
-
moins:- The output could only be defined once and for all. It is not asynchronous and does not support updating.
Usage
- Using
tokiofor your application ? Use thetokio_libfeature. - Using
async-stdfor your application ? Use theasync_std_libfeature. - Using only static information ? Use the
static_outputfeature.
In your Cargo.toml file:
[]
= "4.0.0.alpha4"
# For tokio
= ["tokio_lib"]
# For async_std
= ["async_std_lib"]
# For static output
= ["static_output"]
# If you want search capablities
= ["search"]
Examples
All examples are available in the examples directory and you can run them
using cargo. Remember to set the correct feature for the targeted example
(e.g.: cargo run --example=dyn_tokio --features=tokio_lib).
Using tokio:
use join;
use sleep;
use Write;
use Duration;
async
Using async-std:
use sleep;
use join;
use Write;
use Duration;
async
Some static output:
use Write;
If there are more rows in the terminal than the number of lines in the given
data, minus will simply print the data and quit. This only works in static
paging since asynchronous paging could still receive more data that makes it
pass the limit.
End user help
Here is some help for the end user using an application that depends on minus
| Action | Description |
|---|---|
| Ctrl+C/q | Quit the pager |
| Arrow Up/k | Scroll up by one line |
| Arrow Down/j | Scroll down by one line |
| Page Up | Scroll up by entire page |
| Page Down | Scroll down by entire page |
| Ctrl+U/u | Scroll up by half a screen |
| Ctrl+D/d | Scroll down by half a screen |
| g | Go to the very top of the output |
| G | Go to the very bottom of the output |
| Mouse scroll Up | Scroll up by 5 lines |
| Mouse scroll Down | Scroll down by 5 lines |
| Ctrl+L | Toggle line numbers if not forced enabled/disabled |
| / | Start forward search |
| ? | Start backward search |
| Esc | Cancel search input |
| n | Go to the next search match |
| p | Go to the next previous match |
License
Unless explicitly stated, all works to minus are dual licensed under the
MIT License and Apache License 2.0
Contributing
Issues and pull requests are more than welcome.
See CONTRIBUTING.md on how to contribute to minus.
Thanks
Thank you to everyone here for giving there time and contribution to minus
- @rezural
- @poliorcetics
- @danieleades
- @mark-a
- @mkatychev
- @tomstoneham
- @Hardy7cc
Get in touch
If you want to discuss something with me regarding minus, the best place is at Matrix
@arijit079:matrix.org