TShell

A command tree framework with autocompletion and contextual help based on rustyline.

Supported Platforms * Linux

Build

This project uses Cargo and Rust stable bash cargo build --release

Example

```rust

[macro_use]

extern crate tshell;

use tshell::{CommandTree, CommandResult}; use std::collections::HashMap;

fn world(args: HashMap, o_context: &mut Option, history: &HashMap) -> CommandResult> { println!("World"); Ok(None) }

fn darkness(args: HashMap, o_context: &mut Option, history: &HashMap) -> CommandResult> { if let Some(friend) = args.get("friend") { println!("Darkness, friend = {}", friend); } Ok(None) }

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(); }

```

crates.io

You can use this package in your project by adding the following to your Cargo.toml:

toml [dependencies] tshell = "^0.1"

Features