clap-repl
One of the typical user interfaces for prompting commands is the repl (read eval print loop). One of the best ways of representing commands in a repl
is using space separated arguments, which is what terminal shells do. And the way to parse such commands in Rust is the clap crate. This crate uses
clap and rustyline to provide such user interface in a way that you only focus on your app logic.
Features
Thanks to clap and rustyline this crate handles:
- Parsing the space separated commands into your data structure.
- Help flag for each command.
- Verifying the command is valid, generating useful errors and suggestions otherwise.
- Auto complete and hint for the commands.
Example
use Parser;
use ClapEditor;
use style;
use DefaultEditor;
// This name will show up in clap's error messages, so it is important to set it to "".