Mingling - A CLI framework I wrote for programs with many subcmds

⚓ Rust    📅 2026-07-11    👤 surdeus    👁️ 1      

surdeus

Mingling is a Rust CLI framework that I wrote.
I'm using it to develop programs with many subcommands.
It has a lot of "macro magic", but it's fun to play with!

I'm actively iterating on it, and if you're interested in collaborating, feel free to take a look.

It looks like this:

use mingling::prelude::*;

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

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

pack!(ResultName = String);

#[chain]
fn handle_greet(args: EntryGreet) -> Next {
    let name: ResultName = args
        .inner
        .first()
        .cloned()
        .unwrap_or_else(|| "World".to_string())
        .into();
    name
}

#[renderer]
fn render_name(name: ResultName) -> RenderResult {
    let mut result = RenderResult::default();
    result.println(&format!("Hello, {}!", *name));
    result
}

gen_program!();

Of course, it still has many shortcomings. I warmly welcome you to try it out and contribute!

1 post - 1 participant

Read full topic

🏷️ Rust_feed