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

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

#297 in Cargo plugins

Download history 299/week @ 2024-09-28 166/week @ 2024-10-05 22/week @ 2024-10-12

137 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
~177K SLoC