# libedit
Safe Rust bindings to the [libedit](https://www.thrysoee.dk/editline/)
line-editing library (the BSD alternative to GNU readline).
## Crates
| `libedit` | Safe, ergonomic wrapper with history, completion, hints, and suggestions |
| `libedit-sys` | Raw FFI bindings generated by bindgen |
## Example
```rust
use libedit::EditLine;
let mut el = EditLine::new("example").unwrap();
if let Some(line) = el.readline("prompt> ").unwrap() {
println!("got: {line}");
}
```
A fuller example demonstrating tab completion, history, inline suggestions, and
hints is available in [`libedit/examples/repl.rs`](libedit/examples/repl.rs):
```sh
cargo run --example repl
```
## System dependencies
The libedit development headers and library are required at build time.
| Debian/Ubuntu | `apt install libedit-dev` |
| Fedora/RHEL | `dnf install libedit-devel` |
| macOS (Homebrew) | `brew install libedit` |
| Arch Linux | `pacman -S libedit` |
To regenerate bindings with the `bindgen` feature, also install `libclang-dev`
(or equivalent).
## MSRV
The minimum supported Rust version is **1.82**.
## License
Licensed under the BSD 2-Clause License ([LICENSE](LICENSE)).