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

#32 in Command-line interface

Download history 110/week @ 2018-12-02 82/week @ 2018-12-09 92/week @ 2018-12-16 87/week @ 2018-12-23 87/week @ 2018-12-30 122/week @ 2019-01-06 82/week @ 2019-01-13 89/week @ 2019-01-20 72/week @ 2019-01-27 98/week @ 2019-02-03 51/week @ 2019-02-10 71/week @ 2019-02-17 59/week @ 2019-02-24 87/week @ 2019-03-03 56/week @ 2019-03-10

811 downloads per month
Used in 3 crates

MIT license

201KB
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

~153KB