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

Bump clap from 2.34.0 to 3.0.1 #562

Merged
merged 5 commits into from
Jan 4, 2022
Merged

Bump clap from 2.34.0 to 3.0.1 #562

merged 5 commits into from
Jan 4, 2022

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Jan 3, 2022

Bumps clap from 2.34.0 to 3.0.1.

Release notes

Sourced from clap's releases.

v3.0.1

[3.0.1] - 2022-01-03

Fixes

  • Don't panic when getting number of values (#3241)
  • Don't warn when using default_value_t derive attribute with a Subcommand (#3245)

Documentation

  • Added name attribute to ArgEnum variant derive reference

v3.0.0

Note: clap v3 has been in development for several years and has changed hands multiple times. Unfortunately, our changelog might be incomplete, whether in changes or their motivation.

Highlights

A special thanks to the maintainers, contributors, beta users, and sponsors who have helped along this journey, especially kbknapp.

StructOpt Integration

StructOpt provides a serde-like declarative approach to defining your parser. The main benefits we've seen so far from integrating are:

  • Tighter feedback between the design of clap and the derives
  • More universal traits. Crates exist for common CLI patterns (example) and we've re-designed the StructOpt traits so crates built on clap3 can be reused not just with other derives but also people using the builder API. People can even hand implement these so people using the builder API won't have the pay the cost for derives.

Custom Help Headings

Previously, clap automatically grouped arguments in the help as either ARGS, FLAGS, OPTIONS, and SUBCOMMANDS.

You can now override the default group with Arg::help_heading and App::subcommand_help_heading. To apply a heading to a series of arguments, you can set App::help_heading.

Deprecations

While a lot of deprecations have been added to clean up the API (overloaded meaning of Arg::multiple) or make things more consistent, some particular highlights are:

... (truncated)

Changelog

Sourced from clap's changelog.

[3.0.1] - 2022-01-03

Fixes

  • Don't panic when getting number of values (#3241)
  • Don't warn when using default_value_t derive attribute with a Subcommand (#3245)

Documentation

  • Added name attribute to ArgEnum variant derive reference

[3.0.0] - 2021-12-31

Note: clap v3 has been in development for several years and has changed hands multiple times. Unfortunately, our changelog might be incomplete, whether in changes or their motivation.

Highlights

A special thanks to the maintainers, contributors, beta users, and sponsors who have helped along this journey, especially kbknapp.

StructOpt Integration

StructOpt provides a serde-like declarative approach to defining your parser. The main benefits we've seen so far from integrating are:

  • Tighter feedback between the design of clap and the derives
  • More universal traits. Crates exist for common CLI patterns (example) and we've re-designed the StructOpt traits so crates built on clap3 can be reused not just with other derives but also people using the builder API. People can even hand implement these so people using the builder API won't have the pay the cost for derives.

Custom Help Headings

Previously, clap automatically grouped arguments in the help as either ARGS, FLAGS, OPTIONS, and SUBCOMMANDS.

You can now override the default group with Arg::help_heading and App::subcommand_help_heading. To apply a heading to a series of arguments, you can set App::help_heading.

Deprecations

While a lot of deprecations have been added to clean up the API (overloaded meaning of Arg::multiple) or make things more consistent, some particular highlights are:

... (truncated)

Commits
  • d392b88 chore: Release
  • 1a19d48 docs: Update changelog
  • 3782d8e Merge pull request #3247 from epage/len
  • 5c829ff Merge pull request #3246 from epage/warn
  • e580683 fix: Don't panic when getting number of values
  • 6b9ae54 fix(derive): Don't enit warnings
  • b0cb205 docs(derive): Include name magic attribute
  • 06f24b1 Merge pull request #3243 from intgr/fix-clap_complete-documentation-imports
  • f10c5d1 docs(complete): Fix imports in documentation
  • 879219a Merge pull request #3240 from epage/heck
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [clap](https://github.com/clap-rs/clap) from 2.34.0 to 3.0.1.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](clap-rs/clap@v2.34.0...clap_complete-v3.0.1)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot added dependencies Pull requests that update a dependency file rust Pull requests that update Rust code labels Jan 3, 2022
- Enabled `cargo` feature to allow usage macros for app metadata
- Changed short forms of args from single-char `&str`s to `char`s
Besides replacing the 1:1 deprecated values (these are basically
renames), fixes the usage of the deprecated `multiple` arg option, which
is split into `multiple_values` (`--option 1 2 3`) and
`multiple_occurrences` (`--option 1 --option 2`). ASCII colors,text
colors, and disabled fields, take multiple *values*, while exclude and
type allow multiple occurrences.
@spenserblack
Copy link
Collaborator

⚠️ This PR contains a breaking change

clap used the .multiple arg option, which enabled multiple values and multiple occurrences. In other words, .multiple enabled both --option 1 2 3 and --option 1 --option 2.

In clap v3 .multiple is now deprecated, having been split into .multiple_values and .multiple_occurrences. In f02734d I've changed --ascii-colors, --text-colors, and --disabled-fields to take multiple values, as I believe these match the behavior we desire and the users currently expect.

--exclude and --type have been changed to use multiple occurrences, as I thought that --exclude file1 --exclude file2 and --type prose --type data was a bit more clear, and matches the fact that these args are singular instead of plural ("type" vs "types").

To reiterate, this breaks the existing possible usage of both multiple occurrences and values. For example, onefetch --ascii-colors 0 --ascii-colors 1 was previously possible, but this PR forces it to be onefetch --ascii-colors 0 1.

@spenserblack
Copy link
Collaborator

🤔 Looks like Windows nightly is failing. The failed type inferences don't seem to be related to this PR, but it looks like clap itself is failing to compile on Windows nightly.

* Switch to multiple_values for type and exclude flags to be in line with tokei
* Use default_values fro type flag
* Fix nightly by giving type to possible_backends
@o2sh
Copy link
Owner

o2sh commented Jan 4, 2022

Wow that's a big upgrade 😮, thanks a lot for addressing this issue - and updating the cli - @spenserblack.

I think we should stick to .multiple_values for --types and --exclude to stay inline with tokei.

I fixed the nightly by removing the OS specific initialisation for possible_backends as get_image_backend returns None for windows no matter its input

@spenserblack
Copy link
Collaborator

Thanks, @o2sh!

Yeah, .multiple_values for all is probably the best to use after all. And since it matches the current documented usage, I think it's not a breaking change after all 😃

@o2sh o2sh merged commit 8cbb6d6 into main Jan 4, 2022
@dependabot dependabot bot deleted the dependabot/cargo/clap-3.0.1 branch January 4, 2022 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants