A command tree framework with autocompletion and contextual help based on rustyline.
Supported Platforms * Linux
This project uses Cargo and Rust stable
bash
cargo build --release
```rust
extern crate tshell;
use tshell::{CommandTree, CommandResult}; use std::collections::HashMap;
fn world(args: HashMap
fn darkness(args: HashMap
fn main() { let mut root = shellcommandtree!{mycli, "MyCLI", "0.1.0", [ shellcommandnode!{ cmd: hello, txthelp: "Hello Root", nodes: [ shellcommandnode!{ cmd: world, txthelp: "World", callback: world }, shellcommandnode!{ cmd: darkness, txthelp: "Darkness", callback: darkness, args: [friend => true] } ] }] }; root.run(); }
```
You can use this package in your project by adding the following
to your Cargo.toml
:
toml
[dependencies]
tshell = "^0.1"
Context switching
Command | Action --------- | ------ up | Move a level, exit from current context top | Move to top context exit or quit | Exit the shell help | lists all the available commands ? | contextual help [Object] ? | help for that object