rust-embedded / svd2rust

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

bin: update dependency `clap` to version 4.0 #667

Closed luojia65 closed 1 year ago

luojia65 commented 1 year ago

This pull request updates dependency clap svd2rust binary from 2.0 to 4.0.

It has been years since clap has more user friendly interfaces and more rich ecosystem around it. In this version, we adpot to modern clap-verbosity-flag to describe a log level (not --log_level <LEVEL>, but -v, -vv etc., see https://docs.rs/clap-verbosity-flag). The default cases of command lines is changed to kebab-case in modern clap 4.0, other than snake_case in older versions. Other than that, no changes to command line parameters as well as their help messages are applied in this pull request.

The crate clap_conf is written back to 2021 and lacks people to maintain. It's not good to use it in frequently used embedded Rust toolchain, I rewrote it with a toml and serde based toml file parser to adapt to older version toml based toolchain configurations. If this feature should not be used in the future, we may remove this part of code.

The command line helper after this pull request:

图片

No changes to library code is included in this pull request.

For reviewers: if this pull request would include any unacceptible breaking changes in command line, please note here and I will modify code in this pull request.

rust-highfive commented 1 year ago

r? @reitermarkus

(rust-highfive has picked a reviewer for you, use r? to override)

Emilgardis commented 1 year ago

see https://github.com/rust-embedded/svd2rust/pull/656 which does the same thing (regarding clap 4.0)

Emilgardis commented 1 year ago

with #656 being non breaking, I think that's the solution we should go with

I would personally like to have the flags as both snake and camel case though

therealprof commented 1 year ago

@Emilgardis I agree.

luojia65 commented 1 year ago

@therealprof, @Emilgardis: I agree, #656 looks good to me. After that pull request is merged I should close this one then.