Crates.io | yomi |
lib.rs | yomi |
version | 0.1.2 |
source | src |
created_at | 2024-09-30 21:14:37.166521 |
updated_at | 2024-10-09 14:27:13.39246 |
description | Simple styled CLI builder and terminal command executor. |
homepage | |
repository | https://github.com/dehwyy/yomi |
max_upload_size | |
id | 1392216 |
size | 23,601 |
Simple styled CLI builder + terminal command executor.
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();
}