#builder #command #executor #parser #terminal #styled #subcommand

yomi

Simple styled CLI builder and terminal command executor

3 releases

0.1.2 Oct 9, 2024
0.1.1 Sep 30, 2024
0.1.0 Sep 30, 2024

#236 in Cargo plugins

Download history 310/week @ 2024-09-29 163/week @ 2024-10-06 14/week @ 2024-10-13

188 downloads per month

MIT license

9KB
180 lines

Yomi

Simple styled CLI builder + terminal command executor.

Usage Example

use yomi::prelude::{Parser, Subcommand};
use yomi::{Cli, CommandExecutor};

#[derive(Subcommand)]
enum InputCommand {
    /// cargo {crate_name} mk.
    #[command(name = "mk")]
    MakeDirectory,

    /// cargo {crate_name} rm.
    #[command(name = "rm")]
    RemoveDirectory,
}

#[tokio::main]
async fn main() {
    let cli = Cli::<InputCommand>::parse();

    let r = match cli.get() {
        InputCommand::MakeDirectory => CommandExecutor::execute("mkdir random_directory"),
        InputCommand::RemoveDirectory => CommandExecutor::execute("rm -rf random_directory"),
    };

    r.await.unwrap();
}

More examples.

Dependencies

~6–15MB
~171K SLoC