5 unstable releases

0.5.0 Sep 12, 2020
0.4.0 Sep 12, 2020
0.1.2 Nov 17, 2019
0.1.1 Nov 17, 2019
0.1.0 Nov 17, 2019

#6 in #stupid

39 downloads per month
Used in jetkcli

MIT license

12KB
231 lines

Moins Latest Version Build Status

🥖 "moins" is french for "less" 🥖 ! .

What is moins ?

Moins is a Keep It Simple Stupid less like pager that you can use as a crate.

It aims to be used in other cli app project, you probably don't want to use it as a replacement for less, cause it does less than less.

How to

Add moins to your Cargo.toml dependencies.

[dependencies]
moins = "0.1.0"

Moins expose a single run function and a PagerOption struct to define your pager behavior.

Here is the simplest pager you can run :

extern crate moins;

use moins::Moins;

fn main() {
    let mut content = String::from("👋 🌎!");
    Moins::run(&mut content, None);
}

If you want to add some colors to the pager you can add pagers options :

let mut content = "A noir, E blanc, I rouge, U vert, O bleu, voyelles,
Je dirai quelque jour vos naissances latentes.
A, noir corset velu des mouches éclatantes
Qui bombillent autour des puanteurs cruelles"
.to_owned();

let mut colors = HashMap::new();
colors.insert("A", Color::Black);
colors.insert("E", Color::White);
colors.insert("I", Color::Red);
colors.insert("U", Color::Green);
colors.insert("O", Color::Blue);

let options = PagerOptions {
    colors,
    search: false,
    line_number: false,
};

Moins::run(&mut content, Some(options));

you can run the examples with the command cargo run --example my_example

WIP

Line number

WIP

Key binding

Key Action
Arrow up scroll up
k scroll up
Arrow down scroll down
j scroll down
q quit

Contributing

Contribution are welcome, don't hesitate to submit a PR or fill an issue but keep in mind that moins is a stupid pager. We don't want syntax hilighting, or any fancy feature. If you are looking for something like that bat is probably what you need.

Dependencies

~175KB