2022-08-01 14:02:52 +00:00
|
|
|
use clap::{Parser, ValueEnum};
|
2021-11-30 18:30:19 +00:00
|
|
|
|
|
|
|
#[derive(Parser)]
|
2024-01-17 14:06:56 +00:00
|
|
|
#[command(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 {
|
2022-10-04 12:32:49 +00:00
|
|
|
/// Run swiftly
|
2021-11-30 18:30:19 +00:00
|
|
|
Fast,
|
2022-10-04 12:32:49 +00:00
|
|
|
/// Crawl slowly but steadily
|
|
|
|
///
|
|
|
|
/// This paragraph is ignored because there is no long help text for possible values.
|
2021-11-30 18:30:19 +00:00
|
|
|
Slow,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let cli = Cli::parse();
|
|
|
|
|
|
|
|
match cli.mode {
|
|
|
|
Mode::Fast => {
|
|
|
|
println!("Hare");
|
|
|
|
}
|
|
|
|
Mode::Slow => {
|
|
|
|
println!("Tortoise");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|