Expand description
§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::*;
let mut app = App::new("xCLI")
.version("v0.1")
.author("kingwel.xie@139.com");
app.add_subcommand(Command::new("qwert")
.about("controls testing features")
.usage("qwert")
.action(|_app, _actions| -> XcliResult {
println!("qwert tested");
Ok(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.5"
Macros§
Structs§
- App
- Xcli object
- Command
- Command structure, which describes a command and its action.
- Prefix
Completer - A
PrefixCompleter
for subcommands - Prefix
Node
Enums§
- CmdExe
Code - The return code of Command action.
- Xcli
Error
Type Aliases§
- Xcli
Result - Cmd action execute result