clap-rs/clap
### [`v4.0.32`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4032---2022-12-22)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.31...v4.0.32)
##### Fixes
- *(parser)* When overriding `required(true)`, consider args that conflict with its group
### [`v4.0.31`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4031---2022-12-22)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.30...v4.0.31)
##### Performance
- Speed up parsing when a lot of different flags are present (100 unique flags)
### [`v4.0.30`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4030---2022-12-21)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.29...v4.0.30)
##### Fixes
- *(error)* Improve error for `args_conflicts_with_subcommand`
### [`v4.0.29`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4029---2022-11-29)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.28...v4.0.29)
### [`v4.0.28`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4028---2022-11-29)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.27...v4.0.28)
##### Fixes
- Fix wasm support which was broken in 4.0.27
### [`v4.0.27`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4027---2022-11-24)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.26...v4.0.27)
##### Features
- Have `Arg::value_parser` accept `Vec>`
- Implement `Display` and `FromStr` for `ColorChoice`
##### Fixes
- Remove soundness issue by switching from `atty` to `is-terminal`
### [`v4.0.26`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4026---2022-11-16)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.25...v4.0.26)
##### Fixes
- *(error)* Fix typos in `ContextKind::as_str`
### [`v4.0.25`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4025---2022-11-15)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.24...v4.0.25)
##### Features
- *(error)* Report available subcommands when required subcommand is missing
### [`v4.0.24`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4024---2022-11-14)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.23...v4.0.24)
##### Fixes
- Avoid panic when printing an argument that isn't built
### [`v4.0.23`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4023---2022-11-11)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.22...v4.0.23)
##### Fixes
- Don't panic on reporting invalid-long errors when followed by invalid UTF8
- *(help)* Clarified argument to `help` subcommand
### [`v4.0.22`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4022---2022-11-07)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.21...v4.0.22)
##### Fixes
- *(help)* Don't overflow into next-line-help early due to stale (pre-v4) padding calculations
### [`v4.0.21`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4021---2022-11-07)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.20...v4.0.21)
##### Features
- *(derive)* `long_about` and `long_help` attributes, without a value, force using doc comment (before it wouldn't be set if there wasn't anything different than the short help)
### [`v4.0.20`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4020---2022-11-07)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.19...v4.0.20)
##### Fixes
- *(derive)* Allow defaulted value parser for '()' fields
### [`v4.0.19`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4019---2022-11-04)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.18...v4.0.19)
##### Features
- `ColorChoice` now implements `ValueEnum`
### [`v4.0.18`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4018---2022-10-20)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.17...v4.0.18)
##### Fixes
- *(derive)* Allow `#[command(skip)]` to also work with enum variants with a value
### [`v4.0.17`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4017---2022-10-18)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.16...v4.0.17)
##### Fixes
- Allow using `Arg::last(true)` with `Arg::value_hint(ValueHint::CommandWithArguments)`
### [`v4.0.16`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4016---2022-10-18)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.15...v4.0.16)
##### Fixes
- `Arg::exclusive(true)` should not be exclusive with the argument's own `ArgGroup`
### [`v4.0.15`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4015---2022-10-13)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.14...v4.0.15)
##### Fixes
- *(error)* Don't suggest `--` when it doesn't help
- *(error)* Be more consistent in quoting, punctuation, and indentation in errors
### [`v4.0.14`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4014---2022-10-12)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.13...v4.0.14)
##### Fixes
- Only put `ArgGroup` in `ArgMatches` when explicitly specified, fixing derives handling of option-flattened fields ([#4375](https://togithub.com/clap-rs/clap/issues/4375))
### [`v4.0.13`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4013---2022-10-11)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.12...v4.0.13)
##### Features
- *(derive)* Allow `()` for fields to mean "don't read" ([#4371](https://togithub.com/clap-rs/clap/issues/4371))
### [`v4.0.12`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4012---2022-10-10)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.11...v4.0.12)
##### Features
- Added `TypedValueParser::try_map` for when adapting an existing `TypedValueParser` can fail
- *(error)* Create errors like clap with `Error::new`, `Error::with_cmd`, and `Error::insert`
### [`v4.0.11`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4011---2022-10-09)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.10...v4.0.11)
##### Fixes
- *(help)* Fix wrapping calculations with ANSI escape codes
### [`v4.0.10`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4010---2022-10-05)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.9...v4.0.10)
##### Features
- *(derive)* Support `#[arg(flatten)]` on `Option` types ([#4211](https://togithub.com/clap-rs/clap/issues/4211), [#4350](https://togithub.com/clap-rs/clap/issues/4350))
### [`v4.0.9`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#409---2022-10-03)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.8...v4.0.9)
##### Fixes
- *(derive)* Process doc comments for `#[command(subcommand)]` like in clap v3
### [`v4.0.8`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#408---2022-10-01)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.7...v4.0.8)
##### Fixes
- *(derive)* Remove a low-value assert preventing defaulting `Help` and `Version` actions
### [`v4.0.7`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#407---2022-09-30)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.6...v4.0.7)
##### Features
- *(derive)* Populate implicit ArgGroup ([#3165](https://togithub.com/clap-rs/clap/issues/3165))
##### Fixes
- *(derive)* Support `#[group(skip)]` on `Parser` derive
- *(derive)* Tell users about implicit arg groups when running into group name conflicts
- *(error)* Don't report unrelated groups in conflict or requires errors
### [`v4.0.6`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#406---2022-09-30)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.5...v4.0.6)
##### Features
- *(derive)* Support `#[group(skip)]` ([#4279](https://togithub.com/clap-rs/clap/issues/4279), [#4301](https://togithub.com/clap-rs/clap/issues/4301))
### [`v4.0.5`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#405---2022-09-30)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.4...v4.0.5)
### [`v4.0.4`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#404---2022-09-29)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.3...v4.0.4)
##### Fixes
- *(error)* Specialize the self-conflict error to look like clap v3
### [`v4.0.3`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4032---2022-12-22)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.2...v4.0.3)
##### Fixes
- *(parser)* When overriding `required(true)`, consider args that conflict with its group
### [`v4.0.2`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4029---2022-11-29)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.1...v4.0.2)
### [`v4.0.1`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4019---2022-11-04)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.0...v4.0.1)
##### Features
- `ColorChoice` now implements `ValueEnum`
### [`v4.0.0`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#400---2022-09-28)
[Compare Source](https://togithub.com/clap-rs/clap/compare/v3.2.23...v4.0.0)
##### Highlights
**`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](https://togithub.com/clap-rs/clap/issues/2688) for more background.
**Polishing Help**
Clap strives to give a polished CLI experience out of the box with little
ceremony. With some feedback that has accumulated over time, we took this
release as an opportunity to re-evaluate our `--help` output to make sure it is
meeting that goal.
In doing this evaluation, we wanted to keep in mind:
- Whether other CLIs had ideas that make sense to apply
- Providing an experience that fits within the rest of applications and works across all shells
Before:
git
A fictional versioning CLI
USAGE:
git
OPTIONS:
-h, --help Print help information
SUBCOMMANDS:
add adds things
clone Clones repos
help Print this message or the help of the given subcommand(s)
push pushes things
stash
After:
A fictional versioning CLI
Usage: git
Commands:
clone Clones repos
push pushes things
add adds things
stash
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help information
- name/version header was removed because we couldn't justify the space it occupied when
- Usage already includes the name
- `--version` is available for showing the same thing (if the program has a version set)
- Usage was dropped to one line to save space
- Focus is put on the subcommands
- Headings are now Title case
- The more general term "command" is used rather than being explicit about being "subcommands"
- The output is more dense with the expectation that it won't affect legibility but will allow more content
- We've moved to a more neutral palette for highlighting elements (not highlighted above)
In talking to users, we found some that liked clap's `man`-like experience.
When deviating from this, we are making the assumption that those are more
power users and that the majority of users wouldn't look as favorably on being
consistent with `man`.
See [Issue 4132](https://togithub.com/clap-rs/clap/issues/4132) for more background.
**More Dynamicism**
Clap's API has focused on `&str` for performance but this can make
dealing with owned data difficult, like `#[arg(default_value_t)]` generating a
String from the default value.
Additionally, to avoid `ArgMatches` from borrowing (and for some features we
decided to forgo), clap took the `&str` argument IDs and hashed them. This
prevented us from providing a usable API for iterating over existing arguments.
Now clap has switched to a string newtype that gives us the flexibility to
decide whether to use `&'static str`, `Cow<'static, str>` for fast dynamic behavior, or
`Box` for dynamic behavior with small binary size.
As an extension of that work, you can now call `ArgMatches::ids` to iterate
over the arguments and groups that were found when parsing. The newtype `Id`
was used to prevent some classes of bugs and to make it easier to understand
when opaque Ids are used vs user-visible strings.
**Clearing Out Deprecations**
Instead of doing all development on clap 4.0.0, we implemented a lot of new features during clap 3's development, deprecating the old API while introducing the new API, including:
- Replacing the implicit behavior for args when parsing them with `ArgAction`
- Replacing various one-off forms of value validation with the `ValueParser` API
- Allowing derives to automatically do the right thing for `PathBuf` (allowing invalid UTF-8)
- Replacing `AppSettings` and `ArgSettings` enums with getters/setters
- Clarifying terms and making them more consistent
##### Migrating
Steps:
0. [Upgrade to v3](https://togithub.com/clap-rs/clap/blob/v3-master/CHANGELOG.md#migrating) if you haven't already
1. Add CLI tests (including example below), `-h` and `--help` output at a minimum (recommendation: [trycmd](https://docs.rs/trycmd/) for snapshot testing)
2. *If using Builder API*: Explicitly set the `arg.action(ArgAction::...)` on each argument (`StoreValue` for options and `IncOccurrences` for flags)
3. Run `cargo check --features clap/deprecated` and resolve all deprecation warnings
4. Upgrade to v4
5. Update feature flags
- *If `default-features = false`*, run `cargo add clap -F help,usage,error-context`
- Run `cargo add clap -F wrap_help` unless you want to hard code line wraps
6. Resolve compiler errors
7. Resolve behavior changes (see "subtle changes" under BREAKING CHANGES)
8. *At your leisure:* resolve new deprecation notices
Example test (derive):
```rust
#[derive(clap::Parser)]
struct Cli {
...
}
#[test]
fn verify_cli() {
use clap::CommandFactory;
Cli::command().debug_assert()
}
```
Example test (builder):
```rust
fn cli() -> clap::Command {
...
}
#[test]
fn verify_cli() {
cli().debug_assert();
}
```
Note: the idiomatic / recommended way of specifying different types of args in the Builder API has changed:
Before
```rust
.arg(Arg::new("flag").long("flag")) # --flag
.arg(Arg::new("option").long("option").takes_value(true)) # --option
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
[ ] If you want to rebase/retry this PR, check this box
This PR has been generated by Mend Renovate. View repository job log here.
This PR contains the following updates:
3.2.23
->4.0.32
Release Notes
clap-rs/clap
### [`v4.0.32`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4032---2022-12-22) [Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.31...v4.0.32) ##### Fixes - *(parser)* When overriding `required(true)`, consider args that conflict with its group ### [`v4.0.31`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4031---2022-12-22) [Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.30...v4.0.31) ##### Performance - Speed up parsing when a lot of different flags are present (100 unique flags) ### [`v4.0.30`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4030---2022-12-21) [Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.29...v4.0.30) ##### Fixes - *(error)* Improve error for `args_conflicts_with_subcommand` ### [`v4.0.29`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4029---2022-11-29) [Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.28...v4.0.29) ### [`v4.0.28`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4028---2022-11-29) [Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.27...v4.0.28) ##### Fixes - Fix wasm support which was broken in 4.0.27 ### [`v4.0.27`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4027---2022-11-24) [Compare Source](https://togithub.com/clap-rs/clap/compare/v4.0.26...v4.0.27) ##### Features - Have `Arg::value_parser` accept `VecConfiguration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.