Skip to main content

#
05_01_assert_derive/
05_01_assert.rs

    1use clap::Parser;
    2
    3#[derive(Parser)]
    4#[command(version, about, long_about = None)]
    5struct Cli {
    6    /// Network port to use
    7    port: u16,
    8}
    9
    10fn main() {
    11    let cli = Cli::parse();
    12
    13    println!("PORT = {}", cli.port);
    14}
    15
    16#[test]
    17fn verify_cli() {
    18    use clap::CommandFactory;
    19    Cli::command().debug_assert();
    20}