#[Mìng Lìng]

A proc-macro based Rust CLI framework

scroll

Dispatch, Parse
Then Render

A proc-macro & type-system CLI framework for building complex command-line programs with many subcommands.

  • Separation of concerns: parsing, logic, rendering
  • Compile-time prefix-tree routing (optional)
  • Dynamic shell completion out of the box (optional)

use mingling::prelude::*;

dispatcher!("greet", CMDGreet => EntryGreet);

fn main() {
    let mut program = ThisProgram::new();
    program.with_dispatcher(CMDGreet);
    program.exec_and_exit();
}

pack!(ResultGreeting = String);

#[chain]
fn handle_greet(args: EntryGreet) -> Next {
    let name =
        args.pick_or((), "World").unpack();
    ResultGreeting::new(name)
}

#[renderer]
fn render_greeting(greeting: ResultGreeting) {
    r_println!("Hello, {}!", *greeting);
}

gen_program!();
                    

Mìng Lìng — Build Complex CLIs, For You!

🧩

Separation of Concerns

Decouple parsing, business logic, rendering, help text, and completion — each is just a function with the right attribute macro.

Blazing Dispatch

With the dispatch_tree feature, your subcommand structure is hardened into a prefix tree at compile time. O(len) lookup.

🔄

Dynamic Completion

Enable comp and get smart, context-aware shell completions for bash, zsh, fish, and pwsh — no manual registration.

📦

Lightweight & Modular

Minimal core dependencies. Pull in advanced features (REPL, structured output, Clap binding) only when you need them via feature flags.

📤

Structured Output

Add general_renderer and your program gains --json / --yaml flags automatically. Great for scripting and pipe workflows.

🔁

REPL Mode

Call program.exec_repl() and your CLI becomes an interactive shell — perfect for debugging and exploration.

Ready to command your CLI?

Add Mingling to your project in one line, or dive straight into the docs.

cargo add mingling
📖 Read The Docs GitHub →