use binnev_rust_template::{add, divide, multiply, subtract};
use clap::{Args, Parser, Subcommand};
fn main() {
let cli = Cli::parse();
let result = match cli.command {
Command::Add { a, b } => add(a, b),
Command::Subtract { a, b } => subtract(a, b),
Command::Multiply { a, b } => multiply(a, b),
Command::Divide { a, b } => divide(a, b),
};
println!("Result: {}", result);
}
#[derive(Parser)]
#[command(version, about)]
struct Cli {
#[command(subcommand)]
command: Command,
#[clap(flatten)]
globals: GlobalArgs,
}
#[derive(Args)]
struct GlobalArgs {
#[arg(short, long, action = clap::ArgAction::Count, global = true)]
verbosity: u8,
}
#[derive(Subcommand)]
enum Command {
Add { a: f64, b: f64 },
Subtract { a: f64, b: f64 },
Multiply { a: f64, b: f64 },
Divide { a: f64, b: f64 },
}