Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix incompatibilities when upgrading to clap 4.0
See the clap CHANGELOG: https://github.com/clap-rs/clap/blob/v4.0.18/CHANGELOG.md. `parse(from_os_str)` for a PathBuf just becomes `value_parser`: - For `#[clap(parse(from_os_str)]` for `PathBuf`, replace it with `#[clap(value_parser)]` (as mentioned earlier this will call `value_parser!(PathBuf)` which will auto-select the right `ValueParser` automatically). For `min_values = 2`, this becomes `num_args(2..)`. This is a new interface that replaces a number of old ones: **`Arg::num_args(range)`** Clap has had several ways for controlling how many values will be captured without always being clear on how they interacted, including - `Arg::multiple_values(true)` - `Arg::number_of_values(4)` - `Arg::min_values(2)` - `Arg::max_values(20)` - `Arg::takes_value(true)` These have now all been collapsed into `Arg::num_args` which accepts both single values and ranges of values. `num_args` controls how many raw arguments on the command line will be captured as values per occurrence and independent of value delimiters. See [Issue 2688](clap-rs/clap#2688) for more background. `validator` has been removed, see https://epage.github.io/blog/2022/06/clap-32-last-call-before-40/. We were previously using `validator = ...` to set a function to validate that the value of the DSCP parameter was in the allowed range (0-63). This no longer requires an entire function and we can just write `value_parser = clap::value_parser!(u8).range(0..63)`. However, we lose the ability to detect Windows usage (where we don't support setting the DSCP value) at argument parsing time. For setting the verbosity level based on the number of `-v`'s: - For `#[clap(parse(from_occurrences))]` replaced with `#[clap(action = ArgAction::Count)]` though the field's type must be `u8` (#3794)
- Loading branch information