16 unstable releases (3 breaking)

0.4.4 Nov 20, 2017
0.4.2 Sep 17, 2017
0.4.0 Jul 12, 2017
0.1.3 Aug 31, 2016
0.1.2 Jul 27, 2016

#2 in #completion

Download history 209/week @ 2019-10-04 214/week @ 2019-10-11 292/week @ 2019-10-18 173/week @ 2019-10-25 88/week @ 2019-11-01 64/week @ 2019-11-08 120/week @ 2019-11-15 72/week @ 2019-11-22 77/week @ 2019-11-29 87/week @ 2019-12-06 69/week @ 2019-12-13 27/week @ 2019-12-20 39/week @ 2019-12-27 79/week @ 2020-01-03 258/week @ 2020-01-10

572 downloads per month
Used in 3 crates

MIT license

200KB
5.5K SLoC

liner

A Rust library offering readline-like functionality.

CONTRIBUTING.md

crates.io Build Status Docs

Featues

  • Autosuggestions
  • Emacs and Vi keybindings
  • Multi-line editing
  • History
  • (Incomplete) basic and filename completions
  • Reverse search
  • Remappable keybindings

Basic Usage

In Cargo.toml:

[dependencies]
liner = "0.4.4"
...

In src/main.rs:

extern crate liner;

use liner::Context;

fn main() {
    let mut con = Context::new();

    loop {
        let res = con.read_line("[prompt]$ ", &mut |_| {}).unwrap();

        if res.is_empty() {
            break;
        }

        con.history.push(res.into());
    }
}

See src/main.rs for a more sophisticated example.

License

MIT licensed. See the LICENSE file.

Dependencies

~160KB