Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Clap add help to each argument

use clap::Parser;

#[derive(Parser)]
struct Cli {
    #[arg(long, help = "The name of the test")]
    test: String,

    #[arg(long, default_value = "127.0.0.1", help = "The name of the host")]
    host: String,

    #[arg(long, help = "Debug our code")]
    debug: bool,
}

fn main() {
    let args = Cli::parse();
    println!("host: {}", args.host);
    println!("test: {}", args.test);
    println!("debug: {}", args.debug);
}