2022-08-01 14:02:52 +00:00
|
|
|
use clap::{Parser, ValueEnum};
|
2021-11-30 18:30:19 +00:00
|
|
|
|
|
|
|
#[derive(Parser)]
|
2022-09-02 20:37:23 +00:00
|
|
|
#[command(author, version, about, long_about = None)]
|
2021-11-30 18:30:19 +00:00
|
|
|
struct Cli {
|
|
|
|
/// What mode to run the program in
|
2022-09-02 20:37:23 +00:00
|
|
|
#[arg(value_enum)]
|
2021-11-30 18:30:19 +00:00
|
|
|
mode: Mode,
|
|
|
|
}
|
|
|
|
|
2022-08-01 14:02:52 +00:00
|
|
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
|
2021-11-30 18:30:19 +00:00
|
|
|
enum Mode {
|
|
|
|
Fast,
|
|
|
|
Slow,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let cli = Cli::parse();
|
|
|
|
|
|
|
|
match cli.mode {
|
|
|
|
Mode::Fast => {
|
|
|
|
println!("Hare");
|
|
|
|
}
|
|
|
|
Mode::Slow => {
|
|
|
|
println!("Tortoise");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|