AMythicDev / minus

An asynchronous, runtime data feedable terminal paging library for Rust
https://crates.io/crates/minus/
Apache License 2.0
317 stars 23 forks source link
paging-library rust-lang terminal tui

minus

crates.io ci docs.rs Discord Matrix Crates.io

minus: A library for asynchronous terminal paging, written in Rust.

Motivation

Traditional pagers like more or less weren't made for integrating into other applications. They were meant to be standalone binaries that are executed directly by users. However most applications don't adhere to this and exploit these pagers' functionality by calling them as external programs and passing the data through the standard input. This method worked for Unix and other Unix-like OSs like Linux and MacOS because they already came with any of these pagers installed. But it wasn't this easy on Windows; it required shipping the pager binary along with the applications. Since these programs were originally designed for Unix and Unix-like OSs, distributing these binaries meant shipping an entire environment like MinGW or Cygwin so that these can run properly on Windows.

Recently, some libraries have emerged to solve this issue. They are compiled along with your application and give you a single binary to distribute. The problem with them is that they require you to feed the entire data to the pager before the pager can run, this meant that there will be no output on the terminal until the entire data is loaded by the application and passed on to the pager.

These could cause long delays before output to the terminal if the data comes from a very large file or is being downloaded from the internet.

Features

Usage

Add minus as a dependency in your Cargo.toml file and enable features as you like.

[dependencies.minus]
version = "5.6"
features = [
    # Enable features you want. For example
    "dynamic_output",
    "search",
]

Examples

You can try the provided examples in the examples directory by using cargo:

cargo run --example <example name> --features=<required-features>

# for example to try the `dyn_tokio` example
cargo run --example dyn_tokio --features=dynamic_output,search

See the docs for a summary of examples.

Standard keyboard and mouse bindings

Can be seen in the docs.

MSRV

The latest version of minus requires Rust >= 1.67 to build correctly.

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

minus would never have been this without the :heart: from these kind people

And the help from these projects:-

Get in touch

We are open to discussion and thoughts om improving minus. Join us at Discord or Matrix.