A Rust library offering readline-like functionality.
This was forked from https://gitlab.redox-os.org/redox-os/liner. It has some changes to history (non-duplicating and context sensitive by default) and it supports Windows (10 with an ansi escape capable console).
- Autosuggestions
- Emacs and Vi keybindings
- Multi-line editing
- History
- Basic and filename completions
- Reverse search
- Remappable keybindings
In Cargo.toml:
[dependencies]
sl_liner = "https://github.com/sl-sh-dev/sl-liner"...In src/main.rs:
externcrate liner;use liner::{Context,Completer};structEmptyCompleter;impl<W: std::io::Write>Completer<W>forEmptyCompleter{fncompletions(&mutself,_start:&str) -> Vec<String>{Vec::new()}}fnmain(){letmut con = Context::new();loop{let res = con.read_line("[prompt]$ ",&mutEmptyCompleter).unwrap();if res.is_empty(){break;}
con.history.push(res.into());}}See src/main.rs for a more sophisticated example.
MIT licensed. See the LICENSE file.