| 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 | port: u16, |
| 8 | } |
| 9 | |
| 10 | fn main() { |
| 11 | let cli = Cli::parse(); |
| 12 | |
| 13 | println!("PORT = {}", cli.port); |
| 14 | } |
| 15 | |
| 16 | #[test] |
| 17 | fn verify_cli() { |
| 18 | use clap::CommandFactory; |
| 19 | Cli::command().debug_assert() |
| 20 | } |
| 21 |
