Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
examples/ | H | 30-Jun-2019 | - | 273 | 204 | |
src/ | H | 30-Jun-2019 | - | 7,395 | 6,093 | |
.gitignore | H A D | 30-Jun-2019 | 78 | 8 | 6 | |
.gitlab-ci.yml | H A D | 30-Jun-2019 | 246 | 10 | 9 | |
.travis.yml | H A D | 30-Jun-2019 | 114 | 10 | 9 | |
CONTRIBUTING.md | H A D | 30-Jun-2019 | 388 | 10 | 7 | |
Cargo.toml | H A D | 30-Jun-2019 | 661 | 27 | 23 | |
LICENSE | H A D | 30-Jun-2019 | 1.1 KiB | 22 | 17 | |
README.md | H A D | 30-Jun-2019 | 1.2 KiB | 61 | 45 | |
hist | H A D | 30-Jun-2019 | 5 | 2 | 1 |
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