• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

examples/H30-Jun-2019-273204

src/H30-Jun-2019-7,3956,093

.gitignoreH A D30-Jun-201978 86

.gitlab-ci.ymlH A D30-Jun-2019246 109

.travis.ymlH A D30-Jun-2019114 109

CONTRIBUTING.mdH A D30-Jun-2019388 107

Cargo.tomlH A D30-Jun-2019661 2723

LICENSEH A D30-Jun-20191.1 KiB2217

README.mdH A D30-Jun-20191.2 KiB6145

histH A D30-Jun-20195 21

README.md

1# liner
2A Rust library offering readline-like functionality.
3
4[CONTRIBUTING.md](/CONTRIBUTING.md)
5
6[![crates.io](https://meritbadge.herokuapp.com/liner)](https://crates.io/crates/liner)
7[![Build Status](https://travis-ci.org/MovingtoMars/liner.svg)](https://travis-ci.org/MovingtoMars/liner)
8[![Docs](https://docs.rs/liner/badge.svg)](https://docs.rs/liner/)
9
10## Featues
11- [x] Autosuggestions
12- [x] Emacs and Vi keybindings
13- [x] Multi-line editing
14- [x] History
15- [x] (Incomplete) basic and filename completions
16- [ ] Reverse search
17- [ ] Remappable keybindings
18
19## Basic Usage
20In `Cargo.toml`:
21```toml
22[dependencies]
23liner = "0.5.0"
24...
25```
26
27In `src/main.rs`:
28
29```rust
30extern crate liner;
31
32use liner::{Context, Completer};
33
34struct EmptyCompleter;
35
36impl<W: std::io::Write> Completer<W> for EmptyCompleter {
37    fn completions(&mut self, _start: &str) -> Vec<String> {
38        Vec::new()
39    }
40}
41
42fn main() {
43    let mut con = Context::new();
44
45    loop {
46        let res = con.read_line("[prompt]$ ", &mut EmptyCompleter).unwrap();
47
48        if res.is_empty() {
49            break;
50        }
51
52        con.history.push(res.into());
53    }
54}
55```
56
57**See src/main.rs for a more sophisticated example.**
58
59## License
60MIT licensed. See the `LICENSE` file.
61