Clap Single positional argument



cargo add clap --features derive


examples/clap/single-positional-argument/Cargo.toml
[package]
name = "single-positional-argument"
version = "0.1.0"
edition = "2021"

[dependencies]
clap = { version = "4.5.7", features = ["derive"] }

examples/clap/single-positional-argument/src/main.rs
use clap::Parser;

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

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