1 | use clap::Parser; |
---|---|
2 | |
3 | #[derive(Parser)] |
4 | #[command(author, version, about, long_about = None)] |
5 | struct Cli { |
6 | /// Network port to use |
7 | #[arg(value_parser = clap::value_parser!(u16).range(1..))] |
8 | port: u16, |
9 | } |
10 | |
11 | fn main() { |
12 | let cli = Cli::parse(); |
13 | |
14 | println!("PORT = {}", cli.port); |
15 | } |
16 |