[−][src]Crate xcli
xcli-rs
A CLI implementation in Rust that is based on Rustyline.
Supported Platforms
- Unix
- Windows
- cmd.exe
- Powershell
- MacOS (not tested yet)
Note:
- " quoted argument is not supported
- No prompt is shown when running on non-tty device. Need a simple tweak on Rustyline...
Example
use xcli::*; fn main() { let mut app = App::new("xCLI", 0) .version("v0.1") .author("kingwel.xie@139.com"); app.add_subcommand(Command::new("qwert") .about("controls testing features") .usage("qwert") .action(|app, _| -> CmdExeCode { let _user = app.get_userdata(); println!("qwert tested"); CmdExeCode::Ok })); app.run(); }
crates.io
You can use this package in your project by adding the following
to your Cargo.toml
:
[dependencies]
xcli = "0.1"
Structs
App | Xcli object |
Command | Command structure, which describes a command and its action. |
PrefixCompleter | A |
PrefixNode |
Enums
CmdExeCode | The return code of Command action. |