Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update chapter 2.1 Clap basic #616

Open
c12i opened this issue Sep 26, 2020 · 0 comments
Open

Update chapter 2.1 Clap basic #616

c12i opened this issue Sep 26, 2020 · 0 comments

Comments

@c12i
Copy link

c12i commented Sep 26, 2020

The current code example will not compile if you use the clap v3.0.0-beta.2, the version indicated above it. In this version of clap, the Arg struct no longer has the with_name or the help methods. Instead, use the new and about methods respectively:

//...
let matches = App::new("My Test Program")
        .version("0.1.0")
        .author("Collins Muriuki <[email protected]>")
        .about("Teaches argument parsing")
        .arg(Arg::new("file")
            .short('f')
            .long("file")
            .takes_value(true)
            .about("A cool file"))
//...

Also, the newer short method now accepts a char type rather than &str as a parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant