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

Missing YAML for Arg::last #1173

Closed
AndrewGaspar opened this issue Feb 11, 2018 · 6 comments · Fixed by #1175
Closed

Missing YAML for Arg::last #1173

AndrewGaspar opened this issue Feb 11, 2018 · 6 comments · Fixed by #1175

Comments

@AndrewGaspar
Copy link

AndrewGaspar commented Feb 11, 2018

Rust Version

rustc 1.23.0 (766bd11c8 2018-01-01)

Affected Version of clap

andre@ANDREW-DESKTOP:/mnt/c/Users/andre/Projects/cargo-mpirun$ grep clap Cargo.lock
 "clap 2.29.4 (registry+https://github.com/rust-lang/crates.io-index)",
name = "clap"
"checksum clap 2.29.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7b8f59bcebcfe4269b09f71dab0da15b355c75916a8f975d3876ce81561893ee"

Expected Behavior Summary

The YAML should allow you to specify an arg with last: true, marking it as the last argument

Actual Behavior Summary

YAML fails to parse with this error:

thread 'main' panicked at 'Unknown Arg setting 'last' in YAML file for arg 'args'', /home/andre/.cargo/registry/src/github.com-1ecc6299db9ec823/clap-2.29.4/src/args/arg.rs:147:21note: Run with `RUST_BACKTRACE=1` for a backtrace.

Steps to Reproduce the issue

Create a new clap App from a YAML file.

Example:

cli.yml

name: example
version: "0.1"
author: Foo B. <[email protected]>
about: Fails to compile YAML
args:
    - args:
        last: true
        multiple: true
        allow_hyphen_values: true

main.rs

#[macro_use]
extern crate clap;
use clap::App;

fn main() {
    let cli = load_yaml!("cli.yml");
    let _matches = App::from_yaml(cli).get_matches();
}

Debug output

andre@ANDREW-DESKTOP:/mnt/c/Users/andre/Projects/cargo-mpirun$ cargo run -- --help
   Compiling clap v2.29.4
   Compiling cargo-mpirun v0.1.0 (file:///mnt/c/Users/andre/Projects/cargo-mpirun)
    Finished dev [unoptimized + debuginfo] target(s) in 10.57 secs
     Running `target/debug/cargo-mpirun --help`
thread 'main' panicked at 'Unknown Arg setting 'last' in YAML file for arg 'args'', /home/andre/.cargo/registry/src/github.com-1ecc6299db9ec823/clap-2.29.4/src/args/arg.rs:147:21
note: Run with `RUST_BACKTRACE=1` for a backtrace.
@kbknapp
Copy link
Member

kbknapp commented Feb 11, 2018

Ah, thanks! I'm not at a computer right now, but this will be a quick fix once I can get to one.

@AndrewGaspar
Copy link
Author

@kbknapp Will this fix go into v2.*?

@kbknapp
Copy link
Member

kbknapp commented Feb 12, 2018

Yes, I'll put out v2.29.5 shortly which will include it 😉

@AndrewGaspar
Copy link
Author

Awesome, thank you!

@kbknapp
Copy link
Member

kbknapp commented Feb 13, 2018

@AndrewGaspar this fix was published under v2.30.0 which is on crates.io now

@AndrewGaspar
Copy link
Author

Excellent, thank you!

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.

2 participants