2021-12-23 14:41:52 +00:00
|
|
|
use clap::Parser;
|
|
|
|
|
|
|
|
#[derive(Parser)]
|
2022-01-11 00:47:20 +00:00
|
|
|
#[clap(author, version, about, long_about = None)]
|
2021-12-23 14:41:52 +00:00
|
|
|
struct Cli {
|
|
|
|
/// Network port to use
|
2022-05-21 00:52:04 +00:00
|
|
|
#[clap(value_parser)]
|
|
|
|
port: u16,
|
2021-12-23 14:41:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let cli = Cli::parse();
|
|
|
|
|
|
|
|
println!("PORT = {}", cli.port);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
2022-07-19 18:29:31 +00:00
|
|
|
fn verify_cli() {
|
2022-02-14 22:09:38 +00:00
|
|
|
use clap::CommandFactory;
|
2022-02-14 22:04:07 +00:00
|
|
|
Cli::command().debug_assert()
|
2021-12-23 14:41:52 +00:00
|
|
|
}
|