rust-embedded / svd2rust

Generate Rust register maps (`struct`s) from SVD files
Apache License 2.0
698 stars 150 forks source link

clap error running `svd2rust --help` #681

Closed newAM closed 1 year ago

newAM commented 1 year ago

I was running svd2rust --help with the new v0.27.0 release and got an error:

$ cargo run -- --help
    Finished dev [unoptimized + debuginfo] target(s) in 0.02s
     Running `target/debug/svd2rust --help`
[ERROR svd2rust] Clap error

    Caused by:
        Generate a Rust API from SVD files

        Usage: svd2rust [OPTIONS]

        Options:
          -i <FILE>                        Input SVD file
          -o, --output-dir <PATH>          Directory to place generated files
          -c, --config <TOML_FILE>         Config TOML file
              --target <ARCH>              Target architecture
              --nightly                    Enable features only available to nightly rustc
              --const_generic              Use const generics to generate writers for same fields with different offsets
              --ignore_groups              Don't add alternateGroup name as prefix to register name
              --keep_list                  Keep lists when generating code of dimElement, instead of trying to generate arrays
          -g, --generic_mod                Push generic mod in separate file
              --feature_group              Use group_name of peripherals as feature
              --feature_peripheral         Use independent cfg feature flags for each peripheral
              --max_cluster_size           Use array increment for cluster size
          -m, --make_mod                   Create mod.rs instead of lib.rs, without inner attributes
          -s, --strict                     Make advanced checks due to parsing SVD
              --pascal_enum_values         Use PascalCase in stead of UPPER_CASE for enumerated values
              --derive_more                Use derive_more procedural macros to implement Deref and From
              --source_type <source_type>  Specify file/stream format
          -l, --log <log_level>            Choose which messages to log (overrides RUST_LOG) [possible values: off, error, warn, info, debug, trace]
          -h, --help                       Print help information
          -V, --version                    Print version information

This appears to be cosmetic only due to logging changes.

P.S. Sorry for the initial empty body in this issue, pressing enter submitted the issue before I was ready :sweat_smile:

burrbull commented 1 year ago

Oh. ~Should be due to incorrect clap::ArgAction~

xobs commented 1 year ago

We're seeing this now running svd2rust --version as well:

xobs@ci:~$ /var/lib/jenkins/.cargo/bin/svd2rust --version
[ERROR svd2rust] Clap error

    Caused by:
        svd2rust 0.27.0 ( )

xobs@ci:~$ echo $?
1
xobs@ci:~$

The nonzero exit code means this is more than cosmetic, because it's causing CI to fail.