16 unstable releases (3 breaking)

Uses old Rust 2015

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

#238 in Text editors

Download history 19/week @ 2023-12-18 21/week @ 2023-12-25 4/week @ 2024-01-01 25/week @ 2024-01-08 25/week @ 2024-01-15 19/week @ 2024-01-22 10/week @ 2024-01-29 15/week @ 2024-02-05 27/week @ 2024-02-12 25/week @ 2024-02-19 45/week @ 2024-02-26 38/week @ 2024-03-04 52/week @ 2024-03-11 42/week @ 2024-03-18 27/week @ 2024-03-25 421/week @ 2024-04-01

549 downloads per month
Used in 3 crates

MIT license

200KB
5.5K SLoC

liner

A Rust library offering readline-like functionality.

CONTRIBUTING.md

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

~185–275KB