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

YAML Parsing #3901

Closed
2 tasks done
aress31 opened this issue Jul 8, 2022 · 1 comment
Closed
2 tasks done

YAML Parsing #3901

aress31 opened this issue Jul 8, 2022 · 1 comment
Labels
C-bug Category: Updating dependencies

Comments

@aress31
Copy link

aress31 commented Jul 8, 2022

Please complete the following tasks

Rust Version

rustc 1.62.0 (a8314ef7d 2022-06-27)

Clap Version

3.2.8

Minimal reproducible code

  • main.rs:
use clap::{App, Command, load_yaml};

#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
    
    let yaml = load_yaml!("args.yaml");
    let matches = App::from(yaml).get_matches();
}
  • args.yaml:
name: "tool"
version: "0.1"
about: "description"
author: "m00am"

subcommands:
  - subcommand1:
      args:
        - path:
            index: 1
            required: true
            default_value: "/tmp/"
            help: "Dummy Path"
  - subcommand2:
      args:
         - other_path:
             index: 1
             required: true
             help: "A second dummy path"

Steps to reproduce the bug with the above code

  • Result of cargo build:
error[E0308]: mismatched types
 --> src\main.rs:7:29
  |
7 |     let matches = App::from(yaml).get_matches();
  |                             ^^^^ expected struct `App`, found `&yaml_rust::yaml::Yaml`

Actual Behaviour

Failing with the above error message.

Expected Behaviour

I have followed the documentation and am trying to get a very basic parsing of a yaml structure but for some reasons it does not work.

Additional Context

No response

Debug Output

No response

@aress31 aress31 added the C-bug Category: Updating dependencies label Jul 8, 2022
@epage
Copy link
Member

epage commented Jul 11, 2022

rustdoc might not be showing it on From impls but you need the yaml feature.

I have followed the documentation and am trying to get a very basic parsing of a yaml structure but for some reasons it does not work.
.
Which documentation? We've stripped almost all of it out because of #3087. See https://github.com/aobatact/clap-serde for a possible replacement.

Considering this feature is deprecated and will soon be removed, I'm going to close this as we are not going to be improving the documentation around this.

@epage epage closed this as completed Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Updating dependencies
Projects
None yet
Development

No branches or pull requests

2 participants