use {
clap::{CommandFactory, Parser, ValueEnum},
clap_help::Printer,
};
static INTRO: &str = "
Compute `height x width`
*You can do it either precisely (enough) or fast (I mean not too slow)*.
";
#[derive(Parser, Debug)]
#[command(name = "area", author, version, about, disable_help_flag = true)]
struct Args {
#[arg(long)]
help: bool,
#[arg(short, long, default_value = "9")]
height: u16,
#[arg(short, long, default_value = "3")]
width: u16,
#[arg(short, long)]
kill_birds: bool,
#[arg(long, default_value = "fast")]
strategy: Strategy,
#[arg(short, long, value_name = "SEP")]
separator: Option<String>,
pub root: Option<std::path::PathBuf>,
}
#[derive(ValueEnum, Clone, Copy, Debug)]
enum Strategy {
Fast,
Precise,
}
fn main() {
let args = Args::parse();
if args.help {
Printer::new(Args::command())
.with("introduction", INTRO)
.without("author")
.print_help();
return;
}
let (w, h) = (args.width, args.height);
println!("Computation strategy: {:?}", args.strategy);
println!("{w} x {h} = {}", w * h);
}