Hacker Newsnew | past | comments | ask | show | jobs | submit | jcbhmr's commentslogin

Star Wars: Revenge of the Sith by Matthew Stover


https://doc.rust-lang.org/cargo/reference/unstable.html#scri...

Lets you do this:

    #!/usr/bin/env -S cargo +nightly -Zscript
    ```cargo
    [dependencies]
    clap = { version = "4.2", features = ["derive"] }
    ```
    
    use clap::Parser;
    
    #[derive(Parser, Debug)]
    #[clap(version)]
    struct Args {
        #[clap(short, long, help = "Path to config")]
        config: Option<std::path::PathBuf>,
    }
    
    fn main() {
        let args = Args::parse();
        println!("{:?}", args);
    }


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: