Library to help you create a fancy REPL for your application based on nushell's reedline.
Features:
- Popular clap crate Command used as configuration interface
- General editing functionality, that should feel familiar coming from other shells (e.g. bash, fish, zsh).
- Interactive tab-completion with graphical selection menu
- Fish-style history autosuggestion hints
- History with interactive search options (optionally persists to file, can support multiple sessions accessing the same file)
- Configurable keybindings (default emacs-style bindings).
- Configurable prompt with hooks to update after commands run
- Command Syntax highlighting
- Feature-flag for async support
- Tip: Search history with CTRL+R
, clear input with CTRL+C
, exit repl with CTRL+D
Basic example code:
```rust use reedlinereplrs::clap::{Arg, ArgMatches, Command}; use reedlinereplrs::{Repl, Result};
/// Write "Hello" with given name
fn hello
fn main() -> Result<()> { let mut repl = Repl::new(()) .withname("MyApp") .withversion("v0.1.0") .withdescription("My very cool app") .withbanner("Welcome to MyApp") .with_command( Command::new("hello") .arg(Arg::new("who").required(true)) .about("Greetings!"), hello ); repl.run() } ```
Running the example above:
```plain Welcome to MyApp MyApp〉help MyApp v0.1.0: My very cool app
COMMANDS: hello Greetings! help Print this message or the help of the given subcommand(s)
MyApp〉help hello hello Greetings!
USAGE:
hello
ARGS:
OPTIONS: -h, --help Print help information MyApp〉hello Friend Hello, Friend MyApp〉 ```
Forked from repl-rs by Jacklund, changed to use reedline which is an advanced readline clone and the base of nushell.