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 Several positional arguments

use clap::Parser;

#[derive(Parser)]
struct Cli {
    host: String,

    #[arg(required = true)]
    files: Vec<String>,
    // Probably not a good idea to put a one-value item after a vector of items
    //test: String,
    //test: Vec<String>,
}

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