2021-11-30 18:30:19 +00:00
|
|
|
use clap::{ArgEnum, Parser};
|
|
|
|
|
|
|
|
#[derive(Parser)]
|
2022-01-11 00:47:20 +00:00
|
|
|
#[clap(author, version, about, long_about = None)]
|
2021-11-30 18:30:19 +00:00
|
|
|
struct Cli {
|
|
|
|
/// What mode to run the program in
|
2022-05-21 00:52:04 +00:00
|
|
|
#[clap(arg_enum, value_parser)]
|
2021-11-30 18:30:19 +00:00
|
|
|
mode: Mode,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ArgEnum)]
|
|
|
|
enum Mode {
|
|
|
|
Fast,
|
|
|
|
Slow,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let cli = Cli::parse();
|
|
|
|
|
|
|
|
match cli.mode {
|
|
|
|
Mode::Fast => {
|
|
|
|
println!("Hare");
|
|
|
|
}
|
|
|
|
Mode::Slow => {
|
|
|
|
println!("Tortoise");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|