-
Notifications
You must be signed in to change notification settings - Fork 57
Upgrade clap from 3.2 to 4.0 #225
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fixes several warnings when running `cargo check --features clap/deprecated`: warning: use of deprecated function `<Opts as clap::Args>::augment_args::parse_from_os_str`: Replaced with `#[clap(value_parser)]` for `PathBuf` or `#[clap(value_parser = ...)]` with a custom `TypedValueParser` --> src/main.rs:124:15 | 124 | parse(from_os_str), | ^^^^^^^^^^^ | warning: use of deprecated function `<Opts as clap::Args>::augment_args::parse_from_os_str`: Replaced with `#[clap(value_parser)]` for `PathBuf` or `#[clap(value_parser = ...)]` with a custom `TypedValueParser` --> src/main.rs:146:15 | 146 | parse(from_os_str) | ^^^^^^^^^^^ warning: use of deprecated function `<Opts as clap::Args>::augment_args::parse_from_os_str`: Replaced with `#[clap(value_parser)]` for `PathBuf` or `#[clap(value_parser = ...)]` with a custom `TypedValueParser` --> src/main.rs:179:15 | 179 | parse(from_os_str) | ^^^^^^^^^^^
…unt` Fixes these warnings when running `cargo check --features clap/deprecated`: warning: use of deprecated function `<Opts as clap::Args>::augment_args::parse_from_occurrences`: Replaced with `#[clap(action = ArgAction::Count)]` with a field type of `u8` --> src/main.rs:139:43 | 139 | #[clap(short, long = "verbose", parse(from_occurrences))] | ^^^^^^^^^^^^^^^^ | = note: `#[warn(deprecated)]` on by default warning: use of deprecated function `<Opts as clap::Args>::augment_args_for_update::parse_from_occurrences`: Replaced with `#[clap(action = ArgAction::Count)]` with a field type of `u8` --> src/main.rs:139:43 | 139 | #[clap(short, long = "verbose", parse(from_occurrences))] | ^^^^^^^^^^^^^^^^
Fixes this warning when running `cargo check --features clap/deprecated`: warning: use of deprecated associated function `clap::Arg::<'help>::validator`: Replaced with `Arg::value_parser(...)` Derive: replace `#[clap(validator = <fn>)]` with `#[clap(value_parser = <fn>)]` Builder: replace `arg.validator(<fn>)` with `arg.value_parser(<fn>)` and `matches.value_of` with `matches.get_one::<T>` or `matches.values_of` with `matches.get_many::<T>` --> src/main.rs:125:9 | 125 | validator = validate_dir | ^^^^^^^^^ |
… output With Clap v4 the default changes from lexicographic to WYSIWYG.
The new `wrap_help` feature gets enabled since the code it guards was unconditional before and we want to keep relying on it.
Clap 4 changed the help headings to be title cased. Update out custom heading to stay consistent.
Easiest achieved by renaming the variants to match their CLI names and then deriving ValueEnum.
Fixes these warnings when running `cargo check --features clap/deprecated`: warning: use of deprecated function `<Cargo as clap::Subcommand>::augment_subcommands::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[command(...)]` --> src/main.rs:60:3 | 60 | #[clap(bin_name = "cargo", subcommand_required = true)] | ^^^^ | = note: `#[warn(deprecated)]` on by default warning: use of deprecated function `<Opts as clap::Args>::augment_args::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[command(...)]` --> src/main.rs:66:3 | 66 | #[clap( | ^^^^
Fixes several warnings like this when running `cargo check --features clap/deprecated`: warning: use of deprecated function `<Opts as clap::Args>::augment_args::old_attribute`: Attribute `#[clap(...)]` has been deprecated in favor of `#[arg(...)]` --> src/main.rs:85:7 | 85 | #[clap( | ^^^^
Fixes these warnings when running `cargo check --features clap/deprecated`: warning: use of deprecated function `<Opts as clap::Args>::augment_args::bare_value_parser`: `#[arg(value_parser)]` is now the default and is no longer needed` --> src/main.rs:146:9 | 146 | value_parser | ^^^^^^^^^^^^ | = note: `#[warn(deprecated)]` on by default warning: use of deprecated function `<Opts as clap::Args>::augment_args::bare_value_parser`: `#[arg(value_parser)]` is now the default and is no longer needed` --> src/main.rs:179:9 | 179 | value_parser | ^^^^^^^^^^^^
Thank you! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Supersedes #224.