Update Rust crate clap to v4 #9

Open
pierre wants to merge 1 commits from renovate/clap-4.x into master
Owner

This PR contains the following updates:

Package Type Update Change
clap dependencies major 3.1.18 -> 4.4.0

Release Notes

clap-rs/clap (clap)

v4.4.0

Compare Source

Compatibility
  • Update MSRV to 1.70.0

v4.3.24

Compare Source

Fixes
  • Ensure column padding is preserved in --help with custom templates

v4.3.23

Compare Source

Fixes
  • Fixed UnknownArgumentValueParser to not error on flag's absence

v4.3.22

Compare Source

Features
  • Add UnknownArgumentValueParser for injecting errors for improving the experience with errors

v4.3.21

Compare Source

Features
  • Expose TryMapValueParser so the type can be named

v4.3.20

Compare Source

Features
  • Command::mut_args for modifying all arguments en masse

v4.3.19

Compare Source

Fixes
  • (parse) Respect value_terminator even in the presence of later multiple-value positional arguments

v4.3.18

Compare Source

Fixes
  • (parse) Suggest -- in fewer places where it won't work

v4.3.17

Compare Source

Fixes
  • (help) Address a regression in wrapping PossibleValue descriptions in --help

v4.3.16

Compare Source

Fixes
  • Don't assert when stateful value parsers fail on defaults (e.g. checking if a path exists)

v4.3.15

Compare Source

Features
  • (unstable-styles) Re-export anstyle
Documentation
  • (unstable-styles) Provide more examples

v4.3.14

Compare Source

Features
  • ArgAction::HelpShort and ArgAction::HelpLong for explicitly specifying which style of help to display
Fixes
  • Skip [OPTIONS] in usage if a help or version ArgAction is used

v4.3.13

Compare Source

v4.3.12

Compare Source

Fixes
  • (derive) Don't error on enum variant field attributes

v4.3.11

Compare Source

Features
  • (derive) Support fields wrapped in num::Wrapping, Box, or Arc
  • (derive) Support Box<str>, Box<OsStr>, and Box<Path>

v4.3.10

Compare Source

Performance
  • Drop a dependency, reducing binary size by 1.3 KiB

v4.3.9

Compare Source

Fixes
  • Command::ignore_errors no longer masks help/version

v4.3.8

Compare Source

Fixes
  • Error on ambiguity with infer_long_arg, rather than arbitrarily picking one, matching the documentation and subcommand's behavior

v4.3.7

Compare Source

Documentation
  • Further clarify magic behavior in derive tutorial
  • Further clarify derive API's relationship to builder within the tutorial

v4.3.6

Compare Source

Documentation
  • Suggest clio

v4.3.5

Compare Source

  • ColorChoice::possible_values is added to simplify things for builder users
Fixes
  • ColorChoice::to_possible_value no longer includes descriptions, encouraging shorter help where possible

v4.3.4

Compare Source

Features
  • Add Error::exit_code

v4.3.3

Compare Source

Features
  • Command::defer for delayed initialization of subcommands to reduce startup times of large applications like deno

v4.3.2

Compare Source

Fixes
  • Ensure column padding is preserved in --help with custom templates

v4.3.1

Compare Source

Fixes
  • (parse) Respect value_terminator even in the presence of later multiple-value positional arguments

v4.3.0

Compare Source

Fixes
  • (assert) Allow multiple, value-terminated, positional arguments
  • (assert) Clear up language on last assertion
  • (parser) Correctly assign values to arguments when using multiple, value-termianted, positional arguments
  • (parser) Ensure value_terminator has higher precedence than allow_hyphen_values
  • (help) Only use next-line-help on subcommand list when explicitly specified, not just with --help
  • (help) Correctly align possible values list
  • (help) Don't waste code, vertical space in moving possible value descriptions to next line

v4.2.7

Compare Source

Fixes
  • Correctly track remaining length for iterators provided by ArgMatches

v4.2.6

Compare Source

Features
  • impl Eq<std::any::TypeId> for clap_builder::util::AnyValueId

v4.2.5

Compare Source

Fixes
  • Improve panic when a group requires a non-existent ID

v4.2.4

Compare Source

Documentation
  • Corrected docs for Command::style

v4.2.3

Compare Source

Features
  • Command::styles for theming help/errors (behind unstable-styles)

v4.2.2

Compare Source

Internal
  • Update dependencies

v4.2.1

Compare Source

Fixes
  • Don't highlight uninteresting parts of the error message

v4.2.0

Compare Source

Compatibility
  • Removed the languishing unstable-replace feature (open to discussion at #​2836)
  • Removed the stablized unstable-grouped feature
Features
  • Allow any StyledStr to accept text styled with ANSI escape codes
  • Respect CLICOLOR, CLICOLOR_FORCE
Fixes
  • Lighten the tone for "unexpected argument" errors (open to discussion at #​4638)

v4.1.14

Compare Source

Features
  • (derive) #[group] raw attribute support
Performance
  • (derive) clap_builder was pulled out of clap so it could build in parallel to clap_derive
  • os_str_bytes dependency was removed for faster builds and smaller binaries

v4.1.13

Compare Source

Performance
  • Reduce repeated alloc calls when building a Command
  • Reduce duplicate dependencies for faster builds

v4.1.12

Compare Source

Internal
  • (derive) Update to syn v2
Performance
  • (derive) Faster build times by dropping proc-macro-error dependency

v4.1.11

Compare Source

Internal
  • Update bitflags

v4.1.10

Compare Source

Fixes
  • (help) On Windows, avoid underlined text artifacts

v4.1.9

Compare Source

Fixes
  • (assert) Improve the assert when using the wrong action with get_count / get_flag

v4.1.8

Compare Source

Fixes
  • (derive) Don't deny lints on the users behalf

v4.1.7

Compare Source

Fixes
  • (derive) Hide some nightly clippy warnings

v4.1.6

Compare Source

Fixes
  • (help) Don't show long help for --help just because hidden possible values include a description

v4.1.5

Compare Source

Fixes
  • (help) Don't show long help for --help just because a hidden arg has a possible value with a description

v4.1.4

Compare Source

Fixes
  • (help) Respect disable_colored_help when using arg_required_else_help
Performance
  • Speed up compiling arg! macro

v4.1.3

Compare Source

Fixes
  • (error) Improve suggested flag/value/subcommand when two share a long preifx
  • (error) When suggesting one of several subcommands, use the plural subcommands, rather than subcommand

v4.1.2

Compare Source

Fixes
  • In documentation, refer to get_flag, rather than get_one::<bool>

v4.1.1

Compare Source

Features
  • (derive) #[group] raw attribute support
Performance
  • (derive) clap_builder was pulled out of clap so it could build in parallel to clap_derive
  • os_str_bytes dependency was removed for faster builds and smaller binaries

v4.1.0

Compare Source

Compatibility

MSRV changed to 1.64.0

For apps with custom --help and --version flags:

  • Descriptions for --help and --version changed

When apps have errors imitating clap's error style:

  • Error message style was changed, including
    • Moving away from "did you mean" to tips
    • Leading letter is lower case
    • "For more" added some punctuation
Features
  • ArgMatches::get_occurrences support for argument values to be grouped by their occurrence
Fixes
  • (derive) Allow upgrade_from when arguments / subcommands are explicitly marked as required
  • (help) Try be more clearer and succinct with --help and --version (also helps with overflow)
  • (error) Try to be more clearer and succinct with error messages
  • (error) Officially adopt an error style guide

v4.0.32

Compare Source

Fixes
  • (parser) When overriding required(true), consider args that conflict with its group

v4.0.31

Compare Source

Performance
  • Speed up parsing when a lot of different flags are present (100 unique flags)

v4.0.30

Compare Source

Fixes
  • (error) Improve error for args_conflicts_with_subcommand

v4.0.29

Compare Source

v4.0.28

Compare Source

Fixes
  • Fix wasm support which was broken in 4.0.27

v4.0.27

Compare Source

Features
  • Have Arg::value_parser accept Vec<impl Into<PossibleValue>>
  • Implement Display and FromStr for ColorChoice
Fixes
  • Remove soundness issue by switching from atty to is-terminal

v4.0.26

Compare Source

Fixes
  • (error) Fix typos in ContextKind::as_str

v4.0.25

Compare Source

Features
  • (error) Report available subcommands when required subcommand is missing

v4.0.24

Compare Source

Fixes
  • Avoid panic when printing an argument that isn't built

v4.0.23

Compare Source

Fixes
  • Don't panic on reporting invalid-long errors when followed by invalid UTF8
  • (help) Clarified argument to help subcommand

v4.0.22

Compare Source

Fixes
  • (help) Don't overflow into next-line-help early due to stale (pre-v4) padding calculations

v4.0.21

Compare Source

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

Compare Source

Fixes
  • (derive) Allow defaulted value parser for '()' fields

v4.0.19

Compare Source

Features
  • ColorChoice now implements ValueEnum

v4.0.18

Compare Source

Fixes
  • (derive) Allow #[command(skip)] to also work with enum variants with a value

v4.0.17

Compare Source

Fixes
  • Allow using Arg::last(true) with Arg::value_hint(ValueHint::CommandWithArguments)

v4.0.16

Compare Source

Fixes
  • Arg::exclusive(true) should not be exclusive with the argument's own ArgGroup

v4.0.15

Compare Source

Fixes
  • (error) Don't suggest -- when it doesn't help
  • (error) Be more consistent in quoting, punctuation, and indentation in errors

v4.0.14

Compare Source

Fixes
  • Only put ArgGroup in ArgMatches when explicitly specified, fixing derives handling of option-flattened fields (#​4375)

v4.0.13

Compare Source

Features
  • (derive) Allow () for fields to mean "don't read" (#​4371)

v4.0.12

Compare Source

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

Compare Source

Fixes
  • (help) Fix wrapping calculations with ANSI escape codes

v4.0.10

Compare Source

Features

v4.0.9

Compare Source

Fixes
  • (derive) Process doc comments for #[command(subcommand)] like in clap v3

v4.0.8

Compare Source

Fixes
  • (derive) Remove a low-value assert preventing defaulting Help and Version actions

v4.0.7

Compare Source

Features
  • (derive) Populate implicit ArgGroup (#​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

Compare Source

Features

v4.0.5

Compare Source

v4.0.4

Compare Source

Fixes
  • (error) Specialize the self-conflict error to look like clap v3

v4.0.3

Compare Source

Fixes
  • (parser) When overriding required(true), consider args that conflict with its group

v4.0.2

Compare Source

v4.0.1

Compare Source

Features
  • ColorChoice now implements ValueEnum

v4.0.0

Compare Source

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 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 <SUBCOMMAND>

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 <COMMAND>

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 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<str> 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:

  1. Upgrade to v3 if you haven't already
  2. Add CLI tests (including example below), -h and --help output at a minimum (recommendation: trycmd for snapshot testing)
  3. If using Builder API: Explicitly set the arg.action(ArgAction::...) on each argument (StoreValue for options and IncOccurrences for flags)
  4. Run cargo check --features clap/deprecated and resolve all deprecation warnings
  5. Upgrade to v4
  6. 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
  1. Resolve compiler errors
  2. Resolve behavior changes (see "subtle changes" under BREAKING CHANGES)
  3. At your leisure: resolve new deprecation notices

Example test (derive):


#[derive(clap::Parser)]
struct Cli {
    ...
}

#[test]
fn verify_cli() {
    use clap::CommandFactory;
    Cli::command().debug_assert()
}

Example test (builder):

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

.arg(Arg::new("flag").long("flag"))  # --flag
.arg(Arg::new("option").long("option").takes_value(true))  # --option <option>

After:

.arg(Arg::new("flag").long("flag").action(ArgAction::SetTrue))  # --flag
.arg(Arg::new("option").long("option"))  # --option <option>

In particular, num_args (the replacement for takes_value) will default appropriately
from the ArgAction and generally only needs to be set explicitly for the
other num_args use cases.

Breaking Changes

Subtle changes (i.e. compiler won't catch):

  • arg! now sets one of (#​3795):
    • ArgAction::SetTrue, requiring ArgMatches::get_flag instead of ArgMatches::is_present
    • ArgAction::Count, requiring ArgMatches::get_count instead of ArgMatches::occurrences_of
    • ArgAction::Set, requiring ArgMatches::get_one instead of ArgMatches::value_of
    • ArgAction::Append, requiring ArgMatches::get_many instead of ArgMatches::values_of
  • ArgAction::Set, ArgAction::SetTrue, and Arg::Action::SetFalse now
    conflict by default to be like ArgAction::StoreValue and
    ArgAction::IncOccurrences, requiring cmd.args_override_self(true) to override instead (#​4261)
  • By default, an Args default action is ArgAction::Set, rather than ArgAction::IncOccurrence to reduce confusing magic through consistency (#​2687, #​4032, see also #​3977)
  • mut_arg can no longer be used to customize help and version arguments, instead disable them (Command::disable_help_flag, Command::disable_version_flag) and provide your own (#​4056)
  • Removed lifetimes from Command, Arg, ArgGroup, and PossibleValue, assuming 'static. string feature flag will enable support for Strings (#​1041, #​2150, #​4223)
  • arg!(--flag <value>) is now optional, instead of required. Add .required(true) at the end to restore the original behavior (#​4206)
  • Added default feature flags, help, usage and error-context, requiring adding them back in if default-features = false (#​4236)
  • (parser) Always fill in "" argument for external subcommands to make it easier to distinguish them from built-in commands (#​3263)
  • (parser) Short flags now have higher precedence than hyphen values with Arg::allow_hyphen_values, to be consistent with Command::allow_hyphen_values (#​4187)
  • (parser) Arg::value_terminator must be its own argument on the CLI rather than being in a delimited list (#​4025)
  • (help) Line wrapping of help is now behind the existing wrap_help feature flag, either enable it or hard code your wraps (#​4258)
  • (help) Make DeriveDisplayOrder the default and removed the setting. To sort help, set next_display_order(None) (#​2808)
  • (help) Subcommand display order respects Command::next_display_order instead of DeriveDisplayOrder and using its own initial display order value (#​2808)
  • (help) Subcommands are now listed before arguments. To get the old behavior, see Command::help_template (#​4132)
  • (help) Help headings are now title cased, making any user-provided help headings inconsistent. To get the old behavior, see Command::help_template, Arg::help_heading, and Command::subcommand_help_heading (#​4132)
  • (help) "Command" is used as the section heading for subcommands and COMMAND for the value name. To get the old behavior, see Command::subcommand_help_heading and Arg::subcommand_value_name (#​4132, #​4155)
  • (help) Whitespace in help output is now trimmed to ensure consistency regardless of how well a template matches the users needs. (#​4132, #​4156)
  • (help) name/version/author are removed by default from help output. To get the old behavior, see Command::help_template. (#​4132, #​4160)
  • (help) Indentation for second-line usage changed. (#​4132, #​4188)
  • (env) Parse --help and --version like any ArgAction::SetTrue flag (#​3776)
  • (derive) Leave Arg::id as verbatim casing, requiring updating of string references to other args like in conflicts_with or requires (#​3282)
  • (derive) Doc comments for ValueEnum variants will now show up in --help (#​3312)
  • (derive) When deriving Args, and ArgGroup is created using the type's name, reserving it for future use (#​2621, #​4209)
  • (derive) next_help_heading can now leak out of a #[clap(flatten)], like all other command settings (#​4222)

Easier to catch changes:

  • Looking up a group in ArgMatches now returns the arg Ids, rather than the values to reduce overhead and offer more flexibility. (#​4072)
  • Changed Arg::number_of_values (average-across-occurrences) to Arg::num_args (per-occurrence) (raw CLI args, not parsed values) (#​2688, #​4023)
    • num_args(0) no longer implies takes_value(true).multiple_values(true) (#​4023)
    • num_args(1) no longer implies multiple_values(true) (#​4023)
    • Does not check default or env values, only what the user explicitly passes in (#​4025)
    • No longer terminates on delimited values (#​4025)
  • Replace Arg::min_values (across all occurrences) with Arg::num_args(N..) (per occurrence) to reduce confusion over different value count APIs (#​4023)
  • Replace Arg::max_values (across all occurrences) with Arg::num_args(1..=M) (per occurrence) to reduce confusion over different value count APIs (#​4023)
  • Replace Arg::multiple_values(true) with Arg::num_args(1..) and Arg::multiple_values(false) with Arg::num_args(0) to reduce confusion over different value count APIs (#​4023)
  • Replace Arg::takes_value(true) with Arg::num_args(1) and Arg::takes_value(false) with Arg::num_args(0) to reduce confusion over different value count APIs
  • Remove Arg::require_value_delimiter, either users could use Arg::value_delimiter or implement a custom parser with TypedValueParser as it was mostly to make multiple_values(true) act like multiple_values(false) and isn't needed anymore (#​4026)
  • Arg::new("help") and Arg::new("version") no longer implicitly disable the
    built-in flags and be copied to all subcommands, instead disable
    the built-in flags (Command::disable_help_flag,
    Command::disable_version_flag) and mark the custom flags as global(true). (#​4056)
  • Arg::short('h') no longer implicitly disables the short flag for help,
    instead disable
    the built-in flags (Command::disable_help_flag,
    Command::disable_version_flag) provide your own Arg::new("help").long("help").action(ArgAction::Help).global(true). (#​4056)
  • ArgAction::SetTrue and ArgAction::SetFalse now prioritize Arg::default_missing_value over their standard behavior (#​4000)
  • Changed Arg::requires_ifs and Arg::default_value*_ifs* to taking an ArgPredicate, removing ambiguity with None when accepting owned and borrowed types (#​4084)
  • Removed PartialEq and Eq from Command so we could change external subcommands to use a ValueParser (#​3990)
  • Various Arg, Command, and ArgGroup calls were switched from accepting &[] to [] via IntoIterator to be more flexible (#​4072)
  • Arg::short_aliases and other builder functions that took &[] need the & dropped (#​4081)
  • ErrorKind and Result moved into the error module
  • ErrorKind::EmptyValue replaced with ErrorKind::InvalidValue to remove an unnecessary special case (#​3676, #​3968)
  • ErrorKind::UnrecognizedSubcommand replaced with ErrorKind::InvalidSubcommand to remove an unnecessary special case (#​3676)
  • Changed the default type of allow_external_subcommands from String to OsString as that is less likely to cause bugs in user applications (#​3990)
  • (help) Command::render_usage now returns a StyledStr (#​4248)
  • (derive) Changed the default for arguments from parse to value_parser, removing parse support (#​3827, #​3981)
    • #[clap(value_parser)] and #[clap(action)] are now redundant
  • (derive) subcommand_required(true).arg_required_else_help(true) is set instead of SubcommandRequiredElseHelp to give more meaningful errors when subcommands are missing and to reduce redundancy (#​3280)
  • (derive) Remove arg_enum attribute in favor of value_enum to match the new name (we didn't have support in v3 to mark it deprecated) (#​4127)
  • (parser) Assert when the CLI looksup an unknown args when external subcommand support is enabled to help catch bugs (#​3703)
  • (assert) Sometimes Arg::default_missing_value didn't require num_args(0..=N), now it does (#​4023)
  • (assert) Leading dashes in Arg::long are no longer allowed (#​3691)
  • (assert) Disallow more value_names than num_args (#​2695)
  • (assert) Always enforce that version is specified when the ArgAction::Version is used
  • (assert) Add missing #[track_caller]s to make it easier to debug asserts
  • (assert) Ensure overrides_with IDs are valid
  • (assert) Ensure no self-overrides_with now that Actions replace it
  • (assert) Ensure subcommand names are not duplicated
  • (assert) Assert on mut_arg receiving an invalid arg ID or mut_subcommand receiving an invalid command name
Compatibility

MSRV is now 1.60.0

Deprecated

  • Arg::use_value_delimiter in favor of Arg::value_delimiter to avoid having multiple ways of doing the same thing
  • Arg::requires_all in favor of Arg::requires_ifs now that it takes an ArgPredicate to avoid having multiple ways of doing the same thing
  • Arg::number_of_values in favor of Arg::num_args to clarify semantic differences
  • default_value_os, default_values_os, default_value_if_os, and default_value_ifs_os as the non _os variants now accept either a str or an OsStr (#​4141)
  • Arg::env_os in favor of Arg::env
  • Command::dont_collapse_args_in_usage is now the default (#​4151)
  • Command::trailing_var_arg in favor of Arg::trailing_var_arg to make it clearer which arg it is meant to apply to (#​4187)
  • Command::allow_hyphen_values in favor of Arg::allow_hyphen_values to make it clearer which arg it is meant to apply to (#​4187)
  • Command::allow_negative_numbers in favor of Arg::allow_negative_numbers to make it clearer which arg it is meant to apply to (#​4187)
  • (help) Deprecated Command::write_help and Command::write_long_help in favor of Command::render_help and Command::render_long_help (#​4248)
  • (derive) structopt and clap attributes in favor of the more specific command, arg, and value to open the door for more features and clarify relationship to the builder (#​1807, #​4180)
  • (derive) #[clap(value_parser)] and #[clap(action)] defaulted attributes (its the default) (#​3976)

Behavior Changes

  • (help) With wrap_help feature, if the terminal size cannot be determined, LINES and COLUMNS variables are used (#​4186)
Features
  • Arg::num_args now accepts ranges, allowing setting both the minimum and maximum number of values per occurrence (#​2688, #​4023)
  • Allow non-bool value_parsers for ArgAction::SetTrue / ArgAction::SetFalse (#​4092)
  • Add From<&OsStr>, From<OsString>, From<&str>, and From<String> to value_parser! (#​4257)
  • Allow resetting most builder methods
  • Can now pass runtime generated data to Command, Arg, ArgGroup, PossibleValue, etc without managing lifetimes with the string feature flag (#​2150, #​4223)
  • New default error-context, help and usage feature flags that can be turned off for smaller binaries (#​4236)
  • Added StyledStr::ansi() to Display with ANSI escape codes (#​4248)
  • (error) Error::apply for changing the formatter for dropping binary size (#​4111)
  • (error) Error::renderfor formatting the error into a StyledStr
  • (help) Show PossibleValue::help in long help (--help) (#​3312)
  • (help) New {tab} variable for Command::help_template (#​4161)
  • (help) Command::render_help and Command::render_long_help for formatting the error into a StyledStr (#​3873, #​4248)
  • (help) Command::render_usage now returns a StyledStr (#​4248)
Fixes
  • Verify required is not used with conditional required settings (#​3660)
  • Replaced cmd.allow_invalid_for_utf8_external_subcommands with cmd.external_subcommand_value_parser (#​3733)
  • Arg::default_missing_value now applies per occurrence rather than if a value is missing across all occurrences (#​3998)
  • arg!(--long [value]) to accept 0..=1 per occurrence rather than across all occurrences, making it safe to use with ArgAction::Append (#​4001)
  • Allow OsStrs for Arg::{required_if_eq,required_if_eq_any,required_if_eq_all} (#​4084)
  • (help) With wrap_help feature, if the terminal size cannot be determined, LINES and COLUMNS variables are used (#​4186)
  • (help) Use Command::display_name in the help title rather than Command::bin_name
  • (help) Show when a flag is ArgAction::Count by adding an ... (#​4003)
  • (help) Use a more neutral palette for coloring (#​4132, #​4117)
  • (help) Don't rely on ALL CAPS for help headers (#​4132, #​4123)
  • (help) List subcommands first, focusing the emphasis on them (#​4132, #​4125)
  • (help) Do not include global args in cmd help help (#​4131)
  • (help) Use [positional] in list when relevant (#​4144)
  • (help) Show all [positional] in usage (#​4151)
  • (help) Polish up subcommands by referring to them as commands (#​4132, #​4155)
  • (help) Trim extra whitespace to avoid artifacts from different uses of templates (#​4132, #​4156)
  • (help) Hint to the user the difference between -h / --help when applicable (#​4132, #​4159)
  • (help) Shorten help by eliding name/version/author (#​4132, #​4160)
  • (help) When short help is long enough to activate next_line_help, don't add blank lines (#​4132, #​4190)
  • (help) Make help output more dense (reducing horizontal whitespace) (#​4132, #​4192)
  • (help) Separate subcommand flags with "," like option flags (#​4232, #​4235)
  • (help) Quote the suggested help flag (#​4220)
  • (version) Use Command::display_name rather than Command::bin_name (#​3966)
  • (parser) Always fill in "" argument for external subcommands (#​3263)
  • (parser) Short flags now have higher precedence than hyphen values with Arg::allow_hyphen_values, like Command::allow_hyphen_values (#​4187)
  • (parser) Prefer InvalidSubcommand over UnknownArgument in more cases (#​4219)
  • (derive) Detect escaped external subcommands that look like built-in subcommands (#​3703)
  • (derive) Leave Arg::id as verbatim casing (#​3282)
  • (derive) Default to #[clap(value_parser, action)] instead of #[clap(parse)] (#​3827)

v3.2.25

Compare Source

[3.2.25] - 2023-04-27

Fixes
  • (derive) Resolve warnings in generated code

v3.2.24

Compare Source

[3.2.24] - 2023-04-25

Fixes
  • (derive) Resolve warnings in generated code

v3.2.23

Compare Source

[3.2.23] - 2022-10-24

Fixes
  • Upgrade to textwrap 0.16

v3.2.22

Compare Source

[3.2.22] - 2022-09-16

Fixes
  • Unify dependencies on terminal_size to the 0.2 release

v3.2.21

Compare Source

[3.2.21] - 2022-09-12

Features
  • TypedValueParser::map to allow reusing existing value parsers for other purposes

v3.2.20

Compare Source

[3.2.20] - 2022-09-02

Features
  • ArgMatches::get_count help for ArgAction::Count
  • ArgMatches::get_flag help for ArgAction::SetTrue / ArgAction::SetFalse

v3.2.19

Compare Source

[3.2.19] - 2022-08-30

Fixes
  • (help) Ensure required arguments for parent commands aren't shown in their subcommands when using args_conflicts_with_subcommand

v3.2.18

Compare Source

Fixes
  • (help) Command::print_help now respects Command::colored_help
  • (derive) Improved error messages

v3.2.17

Compare Source

Fixes
  • (derive) Expose #[clap(id = ...)] attribute to match Arg's latest API

v3.2.16

Compare Source

Fixes
  • Ensure required arguments appear in errors when they are also members of a group (#​4004)

v3.2.15

Compare Source

Features
  • (derive) New default_values_t and default_values_os_t attributes

v3.2.14

Compare Source

Fixes
  • A multiple_values positional followed by another positional now works with multiple flags

v3.2.13

Compare Source

Documentation
  • Pulled in tutorials, cookbook, and derive reference into rustdoc

v3.2.12

Compare Source

Fixes
  • Allow an arg to declare a conflict with a group

v3.2.11

Compare Source

Features
  • Added Arg::get_all_short_aliaes and Arg::get_all_aliases

v3.2.10

Compare Source

Fixes
  • Loosen lifetime on Command::mut_subcommand

v3.2.8

Compare Source

Features
  • Added Command::mut_subcommand to mirror Command::mut_arg

v3.2.7

Compare Source

Fixes
  • Global arguments should override env-sourced arguments

v3.2.6

Compare Source

Fixes
  • Don't panic when parsing --=

v3.2.5

Compare Source

Fixes
  • (derive) Fix regression with #[clap(default_value_os_t ...)] introduced in v3.2.3

v3.2.4

Compare Source

Fixes
  • (derive) Provide more clearer deprecation messages for #[clap(parse)] attribute (#​3832)

v3.2.3

Compare Source

Fixes
  • Moved deprecations to be behind the deprecated Cargo.toml feature (#​3830)
    • For now, it is disabled by default though we are considering enabling it by
      default as we release the next major version to help draw attention to the
      deprecation migration path

v3.2.2

Compare Source

Fixes
  • (derive) Improve the highlighted code for deprecation warnings

gated behind unstable-v4

  • (derive) Default to #[clap(value_parser, action)] instead of #[clap(parse)] (#​3827)

v3.2.1

Compare Source

Fixes
  • (help) Command::print_help now respects Command::colored_help
  • (derive) Improved error messages

v3.2.0

Compare Source

Compatibility

MSRV is now 1.56.0 (#​3732)

Behavior

  • Defaults no longer satisfy required and its variants (#​3793)
  • When misusing ArgMatches::value_of and friends, debug asserts were turned into panics

Moving (old location deprecated)

  • clap::{PossibleValue, ValueHint} to clap::builder::{PossibleValue, ValueHint}
  • clap::{Indices, OsValues, ValueSource, Values} to clap::parser::{Indices, OsValues, ValueSource, Values}
  • clap::ArgEnum to clap::ValueEnum (#​3799)

Replaced

  • Arg::allow_invalid_utf8 with Arg::value_parser(value_parser!(PathBuf)) (#​3753)
  • Arg::validator / Arg::validator_os with Arg::value_parser (#​3753)
  • Arg::validator_regex with users providing their own builder::TypedValueParser (#​3756)
  • Arg::forbid_empty_values with builder::NonEmptyStringValueParser / builder::PathBufValueParser (#​3753)
  • Arg::possible_values with Arg::value_parser([...]), builder::PossibleValuesParser, or builder::EnumValueParser (#​3753)
  • Arg::max_occurrences with arg.action(ArgAction::Count).value_parser(value_parser!(u8).range(..N)) for flags (#​3797)
  • Arg::multiple_occurrences with ArgAction::Append or ArgAction::Count though positionals will need Arg::multiple_values (#​3772, #​3797)
  • Command::args_override_self with ArgAction::Set (#​2627, #​3797)
  • AppSettings::NoAutoVersion with ArgAction or Command::disable_version_flag (#​3800)
  • AppSettings::NoHelpVersion with ArgAction or Command::disable_help_flag / Command::disable_help_subcommand (#​3800)
  • ArgMatches::{value_of, value_of_os, value_of_os_lossy, value_of_t} with ArgMatches::{get_one,remove_one} (#​3753)
  • ArgMatches::{values_of, values_of_os, values_of_os_lossy, values_of_t} with ArgMatches::{get_many,remove_many} (#​3753)
  • ArgMatches::is_valid_arg with ArgMatches::{try_get_one,try_get_many} (#​3753)
  • ArgMatches::occurrences_of with ArgMatches::value_source or ArgAction::Count (#​3797)
  • ArgMatches::is_present with ArgMatches::contains_id or ArgAction::SetTrue (#​3797)
  • ArgAction::StoreValue with ArgAction::Set or ArgAction::Append (#​3797)
  • ArgAction::IncOccurrences with ArgAction::SetTrue or ArgAction::Count (#​3797)
  • (derive) #[clap(parse(...))] replaced with: (#​3589, #​3794)
    • For default parsers (no parse attribute), deprecation warnings can be
      silenced by opting into the new behavior by adding either #[clap(action)]
      or #[clap(value_parser)] (ie requesting the default behavior for these
      attributes). Alternatively, the unstable-v4 feature changes the default
      away from parse to action/value_parser.
    • For #[clap(parse(from_flag))] replaced with #[clap(action = ArgAction::SetTrue)] (#​3794)
    • For #[clap(parse(from_occurrences))] replaced with #[clap(action = ArgAction::Count)] though the field's type must be u8 (#​3794)
    • 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 #[clap(parse(try_from_str = ...)], replace it with #[clap(value_parser = ...)]
    • For most other cases, a type implementing TypedValueParser will be needed and specify it with #[clap(value_parser = ...)]
Features
  • Parsed, typed arguments via Arg::value_parser / ArgMatches::{get_one,get_many} (#​2683, #​3732)
    • Several built-in TypedValueParsers available with an API open for expansion
    • value_parser!(T) macro for selecting a parser for a given type (#​3732) and open to expansion via the ValueParserFactory trait (#​3755)
    • [&str] is implicitly a value parser for possible values
    • All ArgMatches getters do not assume required arguments (#​2505)
    • Add ArgMatches::remove_* variants to transfer ownership
    • Add ArgMatches::try_* variants to avoid panics for developer errors (#​3621)
    • Add a get_raw to access the underlying OsStrs
    • PathBuf value parsers imply ValueHint::AnyPath for completions (#​3732)
  • Explicit control over parsing via Arg::action (#​3774)
    • ArgAction::StoreValue: existing takes_value(true) behavior
    • ArgAction::IncOccurrences: existing takes_value(false) behavior
    • ArgAction::Help: existing --help behavior
    • ArgAction::Version: existing --version behavior
    • ArgAction::Set: Overwrite existing values (like Arg::multiple_occurrences mixed with Command::args_override_self) (#​3777)
    • ArgAction::Append: like Arg::multiple_occurrences (#​3777)
    • ArgAction::SetTrue: Treat --flag as --flag=true (#​3775)
      • Implies Arg::default_value("false") (#​3786)
      • Parses Arg::env via Arg::value_parser
    • ArgAction::SetFalse: Treat --flag as --flag=false (#​3775)
      • Implies Arg::default_value("true") (#​3786)
      • Parses Arg::env via Arg::value_parser
    • ArgAction::Count: Treat --flag --flag --flag as --flag=1 --flag=2 --flag=3 (#​3775)
      • Implies Arg::default_value("0") (#​3786)
      • Parses Arg::env via Arg::value_parser
  • (derive) Opt-in to new Arg::value_parser / Arg::action with either #[clap(value_parser)] (#​3589, #​3742) / #[clap(action)] attributes (#​3794)
    • Default ValueParser is determined by value_parser! (#​3199, #​3496)
    • Default ArgAction is determine by a hard-coded lookup on the type (#​3794)
  • Command::multicall is now stable for busybox-like programs and REPLs (#​2861, #​3684)
  • ArgMatches::{try_,}contains_id for checking if there are values for an argument that mirrors the new get_{one,many} API
Fixes
  • Don't correct argument id in default_value_ifs_os(#​3815)

parser

  • Set ArgMatches::value_source and ArgMatches::occurrences_of for external subcommands (#​3732)
  • Use value delimiter for Arg::default_missing_values (#​3761, #​3765)
  • SplitArg::default_value / Arg::env on value delimiters independent of whether -- was used (#​3765)
  • Allow applying defaults to flags (#​3294, 3775)
  • Defaults no longer satisfy required and its variants (#​3793)

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 Renovate Bot.

This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [clap](https://github.com/clap-rs/clap) | dependencies | major | `3.1.18` -> `4.4.0` | --- ### Release Notes <details> <summary>clap-rs/clap (clap)</summary> ### [`v4.4.0`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#440---2023-08-24) [Compare Source](https://github.com/clap-rs/clap/compare/v4.3.24...v4.4.0) ##### Compatibility - Update MSRV to 1.70.0 ### [`v4.3.24`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4324---2023-08-23) [Compare Source](https://github.com/clap-rs/clap/compare/v4.3.23...v4.3.24) ##### Fixes - Ensure column padding is preserved in `--help` with custom templates ### [`v4.3.23`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4323---2023-08-18) [Compare Source](https://github.com/clap-rs/clap/compare/v4.3.22...v4.3.23) ##### Fixes - Fixed `UnknownArgumentValueParser` to not error on flag's absence ### [`v4.3.22`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4322---2023-08-17) [Compare Source](https://github.com/clap-rs/clap/compare/v4.3.21...v4.3.22) ##### Features - Add `UnknownArgumentValueParser` for injecting errors for improving the experience with errors ### [`v4.3.21`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4321---2023-08-08) [Compare Source](https://github.com/clap-rs/clap/compare/v4.3.20...v4.3.21) ##### Features - Expose `TryMapValueParser` so the type can be named ### [`v4.3.20`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4320---2023-08-08) [Compare Source](https://github.com/clap-rs/clap/compare/v4.3.19...v4.3.20) ##### Features - `Command::mut_args` for modifying all arguments en masse ### [`v4.3.19`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4319---2023-07-21) [Compare Source](https://github.com/clap-rs/clap/compare/v4.3.18...v4.3.19) ##### Fixes - *(parse)* Respect `value_terminator` even in the presence of later multiple-value positional arguments ### [`v4.3.18`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4318---2023-07-21) [Compare Source](https://github.com/clap-rs/clap/compare/v4.3.17...v4.3.18) ##### Fixes - *(parse)* Suggest `--` in fewer places where it won't work ### [`v4.3.17`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4317---2023-07-19) [Compare Source](https://github.com/clap-rs/clap/compare/v4.3.16...v4.3.17) ##### Fixes - *(help)* Address a regression in wrapping `PossibleValue` descriptions in `--help` ### [`v4.3.16`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4316---2023-07-18) [Compare Source](https://github.com/clap-rs/clap/compare/v4.3.15...v4.3.16) ##### Fixes - Don't assert when stateful value parsers fail on defaults (e.g. checking if a path exists) ### [`v4.3.15`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4315---2023-07-18) [Compare Source](https://github.com/clap-rs/clap/compare/v4.3.14...v4.3.15) ##### Features - *(unstable-styles)* Re-export `anstyle` ##### Documentation - *(unstable-styles)* Provide more examples ### [`v4.3.14`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4314---2023-07-17) [Compare Source](https://github.com/clap-rs/clap/compare/v4.3.13...v4.3.14) ##### Features - `ArgAction::HelpShort` and `ArgAction::HelpLong` for explicitly specifying which style of help to display ##### Fixes - Skip `[OPTIONS]` in usage if a help or version `ArgAction` is used ### [`v4.3.13`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4313---2023-07-17) [Compare Source](https://github.com/clap-rs/clap/compare/v4.3.12...v4.3.13) ### [`v4.3.12`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4312---2023-07-14) [Compare Source](https://github.com/clap-rs/clap/compare/v4.3.11...v4.3.12) ##### Fixes - *(derive)* Don't error on enum variant field attributes ### [`v4.3.11`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4311---2023-07-05) [Compare Source](https://github.com/clap-rs/clap/compare/v4.3.10...v4.3.11) ##### Features - *(derive)* Support fields wrapped in `num::Wrapping`, `Box`, or `Arc` - *(derive)* Support `Box<str>`, `Box<OsStr>`, and `Box<Path>` ### [`v4.3.10`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4310---2023-06-30) [Compare Source](https://github.com/clap-rs/clap/compare/v4.3.9...v4.3.10) ##### Performance - Drop a dependency, reducing binary size by 1.3 KiB ### [`v4.3.9`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#439---2023-06-28) [Compare Source](https://github.com/clap-rs/clap/compare/v4.3.8...v4.3.9) ##### Fixes - `Command::ignore_errors` no longer masks help/version ### [`v4.3.8`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#438---2023-06-23) [Compare Source](https://github.com/clap-rs/clap/compare/v4.3.7...v4.3.8) ##### Fixes - Error on ambiguity with `infer_long_arg`, rather than arbitrarily picking one, matching the documentation and subcommand's behavior ### [`v4.3.7`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#437---2023-06-23) [Compare Source](https://github.com/clap-rs/clap/compare/v4.3.6...v4.3.7) ##### Documentation - Further clarify magic behavior in derive tutorial - Further clarify derive API's relationship to builder within the tutorial ### [`v4.3.6`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#436---2023-06-23) [Compare Source](https://github.com/clap-rs/clap/compare/v4.3.5...v4.3.6) ##### Documentation - Suggest `clio` ### [`v4.3.5`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#435---2023-06-20) [Compare Source](https://github.com/clap-rs/clap/compare/v4.3.4...v4.3.5) - `ColorChoice::possible_values` is added to simplify things for builder users ##### Fixes - `ColorChoice::to_possible_value` no longer includes descriptions, encouraging shorter help where possible ### [`v4.3.4`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#434---2023-06-14) [Compare Source](https://github.com/clap-rs/clap/compare/v4.3.3...v4.3.4) ##### Features - Add `Error::exit_code` ### [`v4.3.3`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#433---2023-06-09) [Compare Source](https://github.com/clap-rs/clap/compare/v4.3.2...v4.3.3) ##### Features - `Command::defer` for delayed initialization of subcommands to reduce startup times of large applications like deno ### [`v4.3.2`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4324---2023-08-23) [Compare Source](https://github.com/clap-rs/clap/compare/v4.3.1...v4.3.2) ##### Fixes - Ensure column padding is preserved in `--help` with custom templates ### [`v4.3.1`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4319---2023-07-21) [Compare Source](https://github.com/clap-rs/clap/compare/v4.3.0...v4.3.1) ##### Fixes - *(parse)* Respect `value_terminator` even in the presence of later multiple-value positional arguments ### [`v4.3.0`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#430---2023-05-19) [Compare Source](https://github.com/clap-rs/clap/compare/v4.2.7...v4.3.0) ##### Fixes - *(assert)* Allow multiple, value-terminated, positional arguments - *(assert)* Clear up language on `last` assertion - *(parser)* Correctly assign values to arguments when using multiple, value-termianted, positional arguments - *(parser)* Ensure `value_terminator` has higher precedence than `allow_hyphen_values` - *(help)* Only use next-line-help on subcommand list when explicitly specified, not just with `--help` - *(help)* Correctly align possible values list - *(help)* Don't waste code, vertical space in moving possible value descriptions to next line ### [`v4.2.7`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#427---2023-05-02) [Compare Source](https://github.com/clap-rs/clap/compare/v4.2.6...v4.2.7) ##### Fixes - Correctly track remaining length for iterators provided by `ArgMatches` ### [`v4.2.6`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#426---2023-05-02) [Compare Source](https://github.com/clap-rs/clap/compare/v4.2.5...v4.2.6) ##### Features - `impl Eq<std::any::TypeId> for clap_builder::util::AnyValueId` ### [`v4.2.5`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#425---2023-04-27) [Compare Source](https://github.com/clap-rs/clap/compare/v4.2.4...v4.2.5) ##### Fixes - Improve panic when a group requires a non-existent ID ### [`v4.2.4`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#424---2023-04-19) [Compare Source](https://github.com/clap-rs/clap/compare/v4.2.3...v4.2.4) ##### Documentation - Corrected docs for `Command::style` ### [`v4.2.3`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#423---2023-04-18) [Compare Source](https://github.com/clap-rs/clap/compare/v4.2.2...v4.2.3) ##### Features - `Command::styles` for theming help/errors (behind `unstable-styles`) ### [`v4.2.2`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#422---2023-04-13) [Compare Source](https://github.com/clap-rs/clap/compare/v4.2.1...v4.2.2) ##### Internal - Update dependencies ### [`v4.2.1`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#421---2023-03-28) [Compare Source](https://github.com/clap-rs/clap/compare/v4.2.0...v4.2.1) ##### Fixes - Don't highlight uninteresting parts of the error message ### [`v4.2.0`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#420---2023-03-28) [Compare Source](https://github.com/clap-rs/clap/compare/v4.1.14...v4.2.0) ##### Compatibility - Removed the languishing `unstable-replace` feature (open to discussion at [#&#8203;2836](https://github.com/clap-rs/clap/issues/2836)) - Removed the stablized `unstable-grouped` feature ##### Features - Allow any `StyledStr` to accept text styled with ANSI escape codes - Respect `CLICOLOR`, `CLICOLOR_FORCE` ##### Fixes - Lighten the tone for "unexpected argument" errors (open to discussion at [#&#8203;4638](https://github.com/clap-rs/clap/issues/4638)) ### [`v4.1.14`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4114---2023-03-28) [Compare Source](https://github.com/clap-rs/clap/compare/v4.1.13...v4.1.14) ##### Features - *(derive)* `#[group]` raw attribute support ##### Performance - *(derive)* `clap_builder` was pulled out of `clap` so it could build in parallel to `clap_derive` - `os_str_bytes` dependency was removed for faster builds and smaller binaries ### [`v4.1.13`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4113---2023-03-18) [Compare Source](https://github.com/clap-rs/clap/compare/v4.1.12...v4.1.13) ##### Performance - Reduce repeated alloc calls when building a `Command` - Reduce duplicate dependencies for faster builds ### [`v4.1.12`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4112---2023-03-18) [Compare Source](https://github.com/clap-rs/clap/compare/v4.1.11...v4.1.12) ##### Internal - *(derive)* Update to `syn` v2 ##### Performance - *(derive)* Faster build times by dropping `proc-macro-error` dependency ### [`v4.1.11`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4111---2023-03-17) [Compare Source](https://github.com/clap-rs/clap/compare/v4.1.10...v4.1.11) ##### Internal - Update `bitflags` ### [`v4.1.10`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4110---2023-03-17) [Compare Source](https://github.com/clap-rs/clap/compare/v4.1.9...v4.1.10) ##### Fixes - *(help)* On Windows, avoid underlined text artifacts ### [`v4.1.9`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#419---2023-03-16) [Compare Source](https://github.com/clap-rs/clap/compare/v4.1.8...v4.1.9) ##### Fixes - *(assert)* Improve the assert when using the wrong action with `get_count` / `get_flag` ### [`v4.1.8`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#418---2023-02-27) [Compare Source](https://github.com/clap-rs/clap/compare/v4.1.7...v4.1.8) ##### Fixes - *(derive)* Don't `deny` lints on the users behalf ### [`v4.1.7`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#417---2023-02-27) [Compare Source](https://github.com/clap-rs/clap/compare/v4.1.6...v4.1.7) ##### Fixes - *(derive)* Hide some nightly clippy warnings ### [`v4.1.6`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#416---2023-02-15) [Compare Source](https://github.com/clap-rs/clap/compare/v4.1.5...v4.1.6) ##### Fixes - *(help)* Don't show long help for `--help` just because hidden possible values include a description ### [`v4.1.5`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#415---2023-02-15) [Compare Source](https://github.com/clap-rs/clap/compare/v4.1.4...v4.1.5) ##### Fixes - *(help)* Don't show long help for `--help` just because a hidden arg has a possible value with a description ### [`v4.1.4`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#414---2023-01-24) [Compare Source](https://github.com/clap-rs/clap/compare/v4.1.3...v4.1.4) ##### Fixes - *(help)* Respect `disable_colored_help` when using `arg_required_else_help` ##### Performance - Speed up compiling `arg!` macro ### [`v4.1.3`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#413---2023-01-23) [Compare Source](https://github.com/clap-rs/clap/compare/v4.1.2...v4.1.3) ##### Fixes - *(error)* Improve suggested flag/value/subcommand when two share a long preifx - *(error)* When suggesting one of several subcommands, use the plural `subcommands`, rather than `subcommand` ### [`v4.1.2`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#412---2023-01-23) [Compare Source](https://github.com/clap-rs/clap/compare/v4.1.1...v4.1.2) ##### Fixes - In documentation, refer to `get_flag`, rather than `get_one::<bool>` ### [`v4.1.1`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4114---2023-03-28) [Compare Source](https://github.com/clap-rs/clap/compare/v4.1.0...v4.1.1) ##### Features - *(derive)* `#[group]` raw attribute support ##### Performance - *(derive)* `clap_builder` was pulled out of `clap` so it could build in parallel to `clap_derive` - `os_str_bytes` dependency was removed for faster builds and smaller binaries ### [`v4.1.0`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#410---2023-01-13) [Compare Source](https://github.com/clap-rs/clap/compare/v4.0.32...v4.1.0) ##### Compatibility MSRV changed to 1.64.0 For apps with custom `--help` and `--version` flags: - Descriptions for `--help` and `--version` changed When apps have errors imitating clap's error style: - Error message style was changed, including - Moving away from "did you mean" to tips - Leading letter is lower case - "For more" added some punctuation ##### Features - `ArgMatches::get_occurrences` support for argument values to be grouped by their occurrence ##### Fixes - *(derive)* Allow `upgrade_from` when arguments / subcommands are explicitly marked as required - *(help)* Try be more clearer and succinct with `--help` and `--version` (also helps with overflow) - *(error)* Try to be more clearer and succinct with error messages - *(error)* Officially adopt [an error style guide](https://rustc-dev-guide.rust-lang.org/diagnostics.html#suggestion-style-guide) ### [`v4.0.32`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4032---2022-12-22) [Compare Source](https://github.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://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4031---2022-12-22) [Compare Source](https://github.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://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4030---2022-12-21) [Compare Source](https://github.com/clap-rs/clap/compare/v4.0.29...v4.0.30) ##### Fixes - *(error)* Improve error for `args_conflicts_with_subcommand` ### [`v4.0.29`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4029---2022-11-29) [Compare Source](https://github.com/clap-rs/clap/compare/v4.0.28...v4.0.29) ### [`v4.0.28`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4028---2022-11-29) [Compare Source](https://github.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://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4027---2022-11-24) [Compare Source](https://github.com/clap-rs/clap/compare/v4.0.26...v4.0.27) ##### Features - Have `Arg::value_parser` accept `Vec<impl Into<PossibleValue>>` - Implement `Display` and `FromStr` for `ColorChoice` ##### Fixes - Remove soundness issue by switching from `atty` to `is-terminal` ### [`v4.0.26`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4026---2022-11-16) [Compare Source](https://github.com/clap-rs/clap/compare/v4.0.25...v4.0.26) ##### Fixes - *(error)* Fix typos in `ContextKind::as_str` ### [`v4.0.25`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4025---2022-11-15) [Compare Source](https://github.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://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4024---2022-11-14) [Compare Source](https://github.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://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4023---2022-11-11) [Compare Source](https://github.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://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4022---2022-11-07) [Compare Source](https://github.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://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4021---2022-11-07) [Compare Source](https://github.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://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4020---2022-11-07) [Compare Source](https://github.com/clap-rs/clap/compare/v4.0.19...v4.0.20) ##### Fixes - *(derive)* Allow defaulted value parser for '()' fields ### [`v4.0.19`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4019---2022-11-04) [Compare Source](https://github.com/clap-rs/clap/compare/v4.0.18...v4.0.19) ##### Features - `ColorChoice` now implements `ValueEnum` ### [`v4.0.18`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4018---2022-10-20) [Compare Source](https://github.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://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4017---2022-10-18) [Compare Source](https://github.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://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4016---2022-10-18) [Compare Source](https://github.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://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4015---2022-10-13) [Compare Source](https://github.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://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4014---2022-10-12) [Compare Source](https://github.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 ([#&#8203;4375](https://github.com/clap-rs/clap/issues/4375)) ### [`v4.0.13`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4013---2022-10-11) [Compare Source](https://github.com/clap-rs/clap/compare/v4.0.12...v4.0.13) ##### Features - *(derive)* Allow `()` for fields to mean "don't read" ([#&#8203;4371](https://github.com/clap-rs/clap/issues/4371)) ### [`v4.0.12`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4012---2022-10-10) [Compare Source](https://github.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://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4011---2022-10-09) [Compare Source](https://github.com/clap-rs/clap/compare/v4.0.10...v4.0.11) ##### Fixes - *(help)* Fix wrapping calculations with ANSI escape codes ### [`v4.0.10`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4010---2022-10-05) [Compare Source](https://github.com/clap-rs/clap/compare/v4.0.9...v4.0.10) ##### Features - *(derive)* Support `#[arg(flatten)]` on `Option` types ([#&#8203;4211](https://github.com/clap-rs/clap/issues/4211), [#&#8203;4350](https://github.com/clap-rs/clap/issues/4350)) ### [`v4.0.9`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#409---2022-10-03) [Compare Source](https://github.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://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#408---2022-10-01) [Compare Source](https://github.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://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#407---2022-09-30) [Compare Source](https://github.com/clap-rs/clap/compare/v4.0.6...v4.0.7) ##### Features - *(derive)* Populate implicit ArgGroup ([#&#8203;3165](https://github.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://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#406---2022-09-30) [Compare Source](https://github.com/clap-rs/clap/compare/v4.0.5...v4.0.6) ##### Features - *(derive)* Support `#[group(skip)]` ([#&#8203;4279](https://github.com/clap-rs/clap/issues/4279), [#&#8203;4301](https://github.com/clap-rs/clap/issues/4301)) ### [`v4.0.5`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#405---2022-09-30) [Compare Source](https://github.com/clap-rs/clap/compare/v4.0.4...v4.0.5) ### [`v4.0.4`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#404---2022-09-29) [Compare Source](https://github.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://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4032---2022-12-22) [Compare Source](https://github.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://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4029---2022-11-29) [Compare Source](https://github.com/clap-rs/clap/compare/v4.0.1...v4.0.2) ### [`v4.0.1`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4019---2022-11-04) [Compare Source](https://github.com/clap-rs/clap/compare/v4.0.0...v4.0.1) ##### Features - `ColorChoice` now implements `ValueEnum` ### [`v4.0.0`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#400---2022-09-28) [Compare Source](https://github.com/clap-rs/clap/compare/v3.2.25...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://github.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 <SUBCOMMAND> 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 <COMMAND> 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://github.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<str>` 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://github.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 <option> ``` After: ```rust .arg(Arg::new("flag").long("flag").action(ArgAction::SetTrue)) # --flag .arg(Arg::new("option").long("option")) # --option <option> ``` In particular, `num_args` (the replacement for `takes_value`) will default appropriately from the `ArgAction` and generally only needs to be set explicitly for the other `num_args` use cases. ##### Breaking Changes Subtle changes (i.e. compiler won't catch): - `arg!` now sets one of ([#&#8203;3795](https://github.com/clap-rs/clap/issues/3795)): - `ArgAction::SetTrue`, requiring `ArgMatches::get_flag` instead of `ArgMatches::is_present` - `ArgAction::Count`, requiring `ArgMatches::get_count` instead of `ArgMatches::occurrences_of` - `ArgAction::Set`, requiring `ArgMatches::get_one` instead of `ArgMatches::value_of` - `ArgAction::Append`, requiring `ArgMatches::get_many` instead of `ArgMatches::values_of` - `ArgAction::Set`, `ArgAction::SetTrue`, and `Arg::Action::SetFalse` now conflict by default to be like `ArgAction::StoreValue` and `ArgAction::IncOccurrences`, requiring `cmd.args_override_self(true)` to override instead ([#&#8203;4261](https://github.com/clap-rs/clap/issues/4261)) - By default, an `Arg`s default action is `ArgAction::Set`, rather than `ArgAction::IncOccurrence` to reduce confusing magic through consistency ([#&#8203;2687](https://github.com/clap-rs/clap/issues/2687), [#&#8203;4032](https://github.com/clap-rs/clap/issues/4032), see also [#&#8203;3977](https://github.com/clap-rs/clap/issues/3977)) - `mut_arg` can no longer be used to customize help and version arguments, instead disable them (`Command::disable_help_flag`, `Command::disable_version_flag`) and provide your own ([#&#8203;4056](https://github.com/clap-rs/clap/issues/4056)) - Removed lifetimes from `Command`, `Arg`, `ArgGroup`, and `PossibleValue`, assuming `'static`. `string` feature flag will enable support for `String`s ([#&#8203;1041](https://github.com/clap-rs/clap/issues/1041), [#&#8203;2150](https://github.com/clap-rs/clap/issues/2150), [#&#8203;4223](https://github.com/clap-rs/clap/issues/4223)) - `arg!(--flag <value>)` is now optional, instead of required. Add `.required(true)` at the end to restore the original behavior ([#&#8203;4206](https://github.com/clap-rs/clap/issues/4206)) - Added default feature flags, `help`, `usage` and `error-context`, requiring adding them back in if `default-features = false` ([#&#8203;4236](https://github.com/clap-rs/clap/issues/4236)) - *(parser)* Always fill in `""` argument for external subcommands to make it easier to distinguish them from built-in commands ([#&#8203;3263](https://github.com/clap-rs/clap/issues/3263)) - *(parser)* Short flags now have higher precedence than hyphen values with `Arg::allow_hyphen_values`, to be consistent with `Command::allow_hyphen_values` ([#&#8203;4187](https://github.com/clap-rs/clap/issues/4187)) - *(parser)* `Arg::value_terminator` must be its own argument on the CLI rather than being in a delimited list ([#&#8203;4025](https://github.com/clap-rs/clap/issues/4025)) - *(help)* Line wrapping of help is now behind the existing `wrap_help` feature flag, either enable it or hard code your wraps ([#&#8203;4258](https://github.com/clap-rs/clap/issues/4258)) - *(help)* Make `DeriveDisplayOrder` the default and removed the setting. To sort help, set `next_display_order(None)` ([#&#8203;2808](https://github.com/clap-rs/clap/issues/2808)) - *(help)* Subcommand display order respects `Command::next_display_order` instead of `DeriveDisplayOrder` and using its own initial display order value ([#&#8203;2808](https://github.com/clap-rs/clap/issues/2808)) - *(help)* Subcommands are now listed before arguments. To get the old behavior, see `Command::help_template` ([#&#8203;4132](https://github.com/clap-rs/clap/issues/4132)) - *(help)* Help headings are now title cased, making any user-provided help headings inconsistent. To get the old behavior, see `Command::help_template`, `Arg::help_heading`, and `Command::subcommand_help_heading` ([#&#8203;4132](https://github.com/clap-rs/clap/issues/4132)) - *(help)* "Command" is used as the section heading for subcommands and `COMMAND` for the value name. To get the old behavior, see `Command::subcommand_help_heading` and `Arg::subcommand_value_name` ([#&#8203;4132](https://github.com/clap-rs/clap/issues/4132), [#&#8203;4155](https://github.com/clap-rs/clap/issues/4155)) - *(help)* Whitespace in help output is now trimmed to ensure consistency regardless of how well a template matches the users needs. ([#&#8203;4132](https://github.com/clap-rs/clap/issues/4132), [#&#8203;4156](https://github.com/clap-rs/clap/issues/4156)) - *(help)* name/version/author are removed by default from help output. To get the old behavior, see `Command::help_template`. ([#&#8203;4132](https://github.com/clap-rs/clap/issues/4132), [#&#8203;4160](https://github.com/clap-rs/clap/issues/4160)) - *(help)* Indentation for second-line usage changed. ([#&#8203;4132](https://github.com/clap-rs/clap/issues/4132), [#&#8203;4188](https://github.com/clap-rs/clap/issues/4188)) - *(env)* Parse `--help` and `--version` like any `ArgAction::SetTrue` flag ([#&#8203;3776](https://github.com/clap-rs/clap/issues/3776)) - *(derive)* Leave `Arg::id` as `verbatim` casing, requiring updating of string references to other args like in `conflicts_with` or `requires` ([#&#8203;3282](https://github.com/clap-rs/clap/issues/3282)) - *(derive)* Doc comments for `ValueEnum` variants will now show up in `--help` ([#&#8203;3312](https://github.com/clap-rs/clap/issues/3312)) - *(derive)* When deriving `Args`, and `ArgGroup` is created using the type's name, reserving it for future use ([#&#8203;2621](https://github.com/clap-rs/clap/issues/2621), [#&#8203;4209](https://github.com/clap-rs/clap/issues/4209)) - *(derive)* `next_help_heading` can now leak out of a `#[clap(flatten)]`, like all other command settings ([#&#8203;4222](https://github.com/clap-rs/clap/issues/4222)) Easier to catch changes: - Looking up a group in `ArgMatches` now returns the arg `Id`s, rather than the values to reduce overhead and offer more flexibility. ([#&#8203;4072](https://github.com/clap-rs/clap/issues/4072)) - Changed `Arg::number_of_values` (average-across-occurrences) to `Arg::num_args` (per-occurrence) (raw CLI args, not parsed values) ([#&#8203;2688](https://github.com/clap-rs/clap/issues/2688), [#&#8203;4023](https://github.com/clap-rs/clap/issues/4023)) - `num_args(0)` no longer implies `takes_value(true).multiple_values(true)` ([#&#8203;4023](https://github.com/clap-rs/clap/issues/4023)) - `num_args(1)` no longer implies `multiple_values(true)` ([#&#8203;4023](https://github.com/clap-rs/clap/issues/4023)) - Does not check default or env values, only what the user explicitly passes in ([#&#8203;4025](https://github.com/clap-rs/clap/issues/4025)) - No longer terminates on delimited values ([#&#8203;4025](https://github.com/clap-rs/clap/issues/4025)) - Replace `Arg::min_values` (across all occurrences) with `Arg::num_args(N..)` (per occurrence) to reduce confusion over different value count APIs ([#&#8203;4023](https://github.com/clap-rs/clap/issues/4023)) - Replace `Arg::max_values` (across all occurrences) with `Arg::num_args(1..=M)` (per occurrence) to reduce confusion over different value count APIs ([#&#8203;4023](https://github.com/clap-rs/clap/issues/4023)) - Replace `Arg::multiple_values(true)` with `Arg::num_args(1..)` and `Arg::multiple_values(false)` with `Arg::num_args(0)` to reduce confusion over different value count APIs ([#&#8203;4023](https://github.com/clap-rs/clap/issues/4023)) - Replace `Arg::takes_value(true)` with `Arg::num_args(1)` and `Arg::takes_value(false)` with `Arg::num_args(0)` to reduce confusion over different value count APIs - Remove `Arg::require_value_delimiter`, either users could use `Arg::value_delimiter` or implement a custom parser with `TypedValueParser` as it was mostly to make `multiple_values(true)` act like `multiple_values(false)` and isn't needed anymore ([#&#8203;4026](https://github.com/clap-rs/clap/issues/4026)) - `Arg::new("help")` and `Arg::new("version")` no longer implicitly disable the built-in flags and be copied to all subcommands, instead disable the built-in flags (`Command::disable_help_flag`, `Command::disable_version_flag`) and mark the custom flags as `global(true)`. ([#&#8203;4056](https://github.com/clap-rs/clap/issues/4056)) - `Arg::short('h')` no longer implicitly disables the short flag for help, instead disable the built-in flags (`Command::disable_help_flag`, `Command::disable_version_flag`) provide your own `Arg::new("help").long("help").action(ArgAction::Help).global(true)`. ([#&#8203;4056](https://github.com/clap-rs/clap/issues/4056)) - `ArgAction::SetTrue` and `ArgAction::SetFalse` now prioritize `Arg::default_missing_value` over their standard behavior ([#&#8203;4000](https://github.com/clap-rs/clap/issues/4000)) - Changed `Arg::requires_ifs` and `Arg::default_value*_ifs*` to taking an `ArgPredicate`, removing ambiguity with `None` when accepting owned and borrowed types ([#&#8203;4084](https://github.com/clap-rs/clap/issues/4084)) - Removed `PartialEq` and `Eq` from `Command` so we could change external subcommands to use a `ValueParser` ([#&#8203;3990](https://github.com/clap-rs/clap/issues/3990)) - Various `Arg`, `Command`, and `ArgGroup` calls were switched from accepting `&[]` to `[]` via `IntoIterator` to be more flexible ([#&#8203;4072](https://github.com/clap-rs/clap/issues/4072)) - `Arg::short_aliases` and other builder functions that took `&[]` need the `&` dropped ([#&#8203;4081](https://github.com/clap-rs/clap/issues/4081)) - `ErrorKind` and `Result` moved into the `error` module - `ErrorKind::EmptyValue` replaced with `ErrorKind::InvalidValue` to remove an unnecessary special case ([#&#8203;3676](https://github.com/clap-rs/clap/issues/3676), [#&#8203;3968](https://github.com/clap-rs/clap/issues/3968)) - `ErrorKind::UnrecognizedSubcommand` replaced with `ErrorKind::InvalidSubcommand` to remove an unnecessary special case ([#&#8203;3676](https://github.com/clap-rs/clap/issues/3676)) - Changed the default type of `allow_external_subcommands` from `String` to `OsString` as that is less likely to cause bugs in user applications ([#&#8203;3990](https://github.com/clap-rs/clap/issues/3990)) - *(help)* `Command::render_usage` now returns a `StyledStr` ([#&#8203;4248](https://github.com/clap-rs/clap/issues/4248)) - *(derive)* Changed the default for arguments from `parse` to `value_parser`, removing `parse` support ([#&#8203;3827](https://github.com/clap-rs/clap/issues/3827), [#&#8203;3981](https://github.com/clap-rs/clap/issues/3981)) - `#[clap(value_parser)]` and `#[clap(action)]` are now redundant - *(derive)* `subcommand_required(true).arg_required_else_help(true)` is set instead of `SubcommandRequiredElseHelp` to give more meaningful errors when subcommands are missing and to reduce redundancy ([#&#8203;3280](https://github.com/clap-rs/clap/issues/3280)) - *(derive)* Remove `arg_enum` attribute in favor of `value_enum` to match the new name (we didn't have support in v3 to mark it deprecated) ([#&#8203;4127](https://github.com/clap-rs/clap/issues/4127)) - *(parser)* Assert when the CLI looksup an unknown args when external subcommand support is enabled to help catch bugs ([#&#8203;3703](https://github.com/clap-rs/clap/issues/3703)) - *(assert)* Sometimes `Arg::default_missing_value` didn't require `num_args(0..=N)`, now it does ([#&#8203;4023](https://github.com/clap-rs/clap/issues/4023)) - *(assert)* Leading dashes in `Arg::long` are no longer allowed ([#&#8203;3691](https://github.com/clap-rs/clap/issues/3691)) - *(assert)* Disallow more `value_names` than `num_args` ([#&#8203;2695](https://github.com/clap-rs/clap/issues/2695)) - *(assert)* Always enforce that version is specified when the `ArgAction::Version` is used - *(assert)* Add missing `#[track_caller]`s to make it easier to debug asserts - *(assert)* Ensure `overrides_with` IDs are valid - *(assert)* Ensure no self-`overrides_with` now that Actions replace it - *(assert)* Ensure subcommand names are not duplicated - *(assert)* Assert on `mut_arg` receiving an invalid arg ID or `mut_subcommand` receiving an invalid command name ##### Compatibility MSRV is now 1.60.0 Deprecated - `Arg::use_value_delimiter` in favor of `Arg::value_delimiter` to avoid having multiple ways of doing the same thing - `Arg::requires_all` in favor of `Arg::requires_ifs` now that it takes an `ArgPredicate` to avoid having multiple ways of doing the same thing - `Arg::number_of_values` in favor of `Arg::num_args` to clarify semantic differences - `default_value_os`, `default_values_os`, `default_value_if_os`, and `default_value_ifs_os` as the non `_os` variants now accept either a `str` or an `OsStr` ([#&#8203;4141](https://github.com/clap-rs/clap/issues/4141)) - `Arg::env_os` in favor of `Arg::env` - `Command::dont_collapse_args_in_usage` is now the default ([#&#8203;4151](https://github.com/clap-rs/clap/issues/4151)) - `Command::trailing_var_arg` in favor of `Arg::trailing_var_arg` to make it clearer which arg it is meant to apply to ([#&#8203;4187](https://github.com/clap-rs/clap/issues/4187)) - `Command::allow_hyphen_values` in favor of `Arg::allow_hyphen_values` to make it clearer which arg it is meant to apply to ([#&#8203;4187](https://github.com/clap-rs/clap/issues/4187)) - `Command::allow_negative_numbers` in favor of `Arg::allow_negative_numbers` to make it clearer which arg it is meant to apply to ([#&#8203;4187](https://github.com/clap-rs/clap/issues/4187)) - *(help)* Deprecated `Command::write_help` and `Command::write_long_help` in favor of `Command::render_help` and `Command::render_long_help` ([#&#8203;4248](https://github.com/clap-rs/clap/issues/4248)) - *(derive)* `structopt` and `clap` attributes in favor of the more specific `command`, `arg`, and `value` to open the door for [more features](https://github.com/clap-rs/clap/issues/1807) and [clarify relationship to the builder](https://github.com/clap-rs/clap/discussions/4090) ([#&#8203;1807](https://github.com/clap-rs/clap/issues/1807), [#&#8203;4180](https://github.com/clap-rs/clap/issues/4180)) - *(derive)* `#[clap(value_parser)]` and `#[clap(action)]` defaulted attributes (its the default) ([#&#8203;3976](https://github.com/clap-rs/clap/issues/3976)) Behavior Changes - *(help)* With `wrap_help` feature, if the terminal size cannot be determined, `LINES` and `COLUMNS` variables are used ([#&#8203;4186](https://github.com/clap-rs/clap/issues/4186)) ##### Features - `Arg::num_args` now accepts ranges, allowing setting both the minimum and maximum number of values per occurrence ([#&#8203;2688](https://github.com/clap-rs/clap/issues/2688), [#&#8203;4023](https://github.com/clap-rs/clap/issues/4023)) - Allow non-bool `value_parser`s for `ArgAction::SetTrue` / `ArgAction::SetFalse` ([#&#8203;4092](https://github.com/clap-rs/clap/issues/4092)) - Add `From<&OsStr>`, `From<OsString>`, `From<&str>`, and `From<String>` to `value_parser!` ([#&#8203;4257](https://github.com/clap-rs/clap/issues/4257)) - Allow resetting most builder methods - Can now pass runtime generated data to `Command`, `Arg`, `ArgGroup`, `PossibleValue`, etc without managing lifetimes with the `string` feature flag ([#&#8203;2150](https://github.com/clap-rs/clap/issues/2150), [#&#8203;4223](https://github.com/clap-rs/clap/issues/4223)) - New default `error-context`, `help` and `usage` feature flags that can be turned off for smaller binaries ([#&#8203;4236](https://github.com/clap-rs/clap/issues/4236)) - Added `StyledStr::ansi()` to `Display` with ANSI escape codes ([#&#8203;4248](https://github.com/clap-rs/clap/issues/4248)) - *(error)* `Error::apply` for changing the formatter for dropping binary size ([#&#8203;4111](https://github.com/clap-rs/clap/issues/4111)) - *(error)* `Error::render`for formatting the error into a `StyledStr` - *(help)* Show `PossibleValue::help` in long help (`--help`) ([#&#8203;3312](https://github.com/clap-rs/clap/issues/3312)) - *(help)* New `{tab}` variable for `Command::help_template` ([#&#8203;4161](https://github.com/clap-rs/clap/issues/4161)) - *(help)* `Command::render_help` and `Command::render_long_help` for formatting the error into a `StyledStr` ([#&#8203;3873](https://github.com/clap-rs/clap/issues/3873), [#&#8203;4248](https://github.com/clap-rs/clap/issues/4248)) - *(help)* `Command::render_usage` now returns a `StyledStr` ([#&#8203;4248](https://github.com/clap-rs/clap/issues/4248)) ##### Fixes - Verify `required` is not used with conditional required settings ([#&#8203;3660](https://github.com/clap-rs/clap/issues/3660)) - Replaced `cmd.allow_invalid_for_utf8_external_subcommands` with `cmd.external_subcommand_value_parser` ([#&#8203;3733](https://github.com/clap-rs/clap/issues/3733)) - `Arg::default_missing_value` now applies per occurrence rather than if a value is missing across all occurrences ([#&#8203;3998](https://github.com/clap-rs/clap/issues/3998)) - `arg!(--long [value])` to accept `0..=1` per occurrence rather than across all occurrences, making it safe to use with `ArgAction::Append` ([#&#8203;4001](https://github.com/clap-rs/clap/issues/4001)) - Allow `OsStr`s for `Arg::{required_if_eq,required_if_eq_any,required_if_eq_all}` ([#&#8203;4084](https://github.com/clap-rs/clap/issues/4084)) - *(help)* With `wrap_help` feature, if the terminal size cannot be determined, `LINES` and `COLUMNS` variables are used ([#&#8203;4186](https://github.com/clap-rs/clap/issues/4186)) - *(help)* Use `Command::display_name` in the help title rather than `Command::bin_name` - *(help)* Show when a flag is `ArgAction::Count` by adding an `...` ([#&#8203;4003](https://github.com/clap-rs/clap/issues/4003)) - *(help)* Use a more neutral palette for coloring ([#&#8203;4132](https://github.com/clap-rs/clap/issues/4132), [#&#8203;4117](https://github.com/clap-rs/clap/issues/4117)) - *(help)* Don't rely on ALL CAPS for help headers ([#&#8203;4132](https://github.com/clap-rs/clap/issues/4132), [#&#8203;4123](https://github.com/clap-rs/clap/issues/4123)) - *(help)* List subcommands first, focusing the emphasis on them ([#&#8203;4132](https://github.com/clap-rs/clap/issues/4132), [#&#8203;4125](https://github.com/clap-rs/clap/issues/4125)) - *(help)* Do not include global args in `cmd help help` ([#&#8203;4131](https://github.com/clap-rs/clap/issues/4131)) - *(help)* Use `[positional]` in list when relevant ([#&#8203;4144](https://github.com/clap-rs/clap/issues/4144)) - *(help)* Show all `[positional]` in usage ([#&#8203;4151](https://github.com/clap-rs/clap/issues/4151)) - *(help)* Polish up subcommands by referring to them as commands ([#&#8203;4132](https://github.com/clap-rs/clap/issues/4132), [#&#8203;4155](https://github.com/clap-rs/clap/issues/4155)) - *(help)* Trim extra whitespace to avoid artifacts from different uses of templates ([#&#8203;4132](https://github.com/clap-rs/clap/issues/4132), [#&#8203;4156](https://github.com/clap-rs/clap/issues/4156)) - *(help)* Hint to the user the difference between `-h` / `--help` when applicable ([#&#8203;4132](https://github.com/clap-rs/clap/issues/4132), [#&#8203;4159](https://github.com/clap-rs/clap/issues/4159)) - *(help)* Shorten help by eliding name/version/author ([#&#8203;4132](https://github.com/clap-rs/clap/issues/4132), [#&#8203;4160](https://github.com/clap-rs/clap/issues/4160)) - *(help)* When short help is long enough to activate `next_line_help`, don't add blank lines ([#&#8203;4132](https://github.com/clap-rs/clap/issues/4132), [#&#8203;4190](https://github.com/clap-rs/clap/issues/4190)) - *(help)* Make help output more dense (reducing horizontal whitespace) ([#&#8203;4132](https://github.com/clap-rs/clap/issues/4132), [#&#8203;4192](https://github.com/clap-rs/clap/issues/4192)) - *(help)* Separate subcommand flags with "," like option flags ([#&#8203;4232](https://github.com/clap-rs/clap/issues/4232), [#&#8203;4235](https://github.com/clap-rs/clap/issues/4235)) - *(help)* Quote the suggested help flag ([#&#8203;4220](https://github.com/clap-rs/clap/issues/4220)) - *(version)* Use `Command::display_name` rather than `Command::bin_name` ([#&#8203;3966](https://github.com/clap-rs/clap/issues/3966)) - *(parser)* Always fill in `""` argument for external subcommands ([#&#8203;3263](https://github.com/clap-rs/clap/issues/3263)) - *(parser)* Short flags now have higher precedence than hyphen values with `Arg::allow_hyphen_values`, like `Command::allow_hyphen_values` ([#&#8203;4187](https://github.com/clap-rs/clap/issues/4187)) - *(parser)* Prefer `InvalidSubcommand` over `UnknownArgument` in more cases ([#&#8203;4219](https://github.com/clap-rs/clap/issues/4219)) - *(derive)* Detect escaped external subcommands that look like built-in subcommands ([#&#8203;3703](https://github.com/clap-rs/clap/issues/3703)) - *(derive)* Leave `Arg::id` as `verbatim` casing ([#&#8203;3282](https://github.com/clap-rs/clap/issues/3282)) - *(derive)* Default to `#[clap(value_parser, action)]` instead of `#[clap(parse)]` ([#&#8203;3827](https://github.com/clap-rs/clap/issues/3827)) ### [`v3.2.25`](https://github.com/clap-rs/clap/releases/tag/v3.2.25) [Compare Source](https://github.com/clap-rs/clap/compare/v3.2.24...v3.2.25) #### \[3.2.25] - 2023-04-27 ##### Fixes - *(derive)* Resolve warnings in generated code ### [`v3.2.24`](https://github.com/clap-rs/clap/releases/tag/v3.2.24) [Compare Source](https://github.com/clap-rs/clap/compare/v3.2.23...v3.2.24) #### \[3.2.24] - 2023-04-25 ##### Fixes - *(derive)* Resolve warnings in generated code ### [`v3.2.23`](https://github.com/clap-rs/clap/releases/tag/v3.2.23) [Compare Source](https://github.com/clap-rs/clap/compare/v3.2.22...v3.2.23) #### \[3.2.23] - 2022-10-24 ##### Fixes - Upgrade to `textwrap` 0.16 ### [`v3.2.22`](https://github.com/clap-rs/clap/releases/tag/v3.2.22) [Compare Source](https://github.com/clap-rs/clap/compare/v3.2.21...v3.2.22) #### \[3.2.22] - 2022-09-16 ##### Fixes - Unify dependencies on `terminal_size` to the 0.2 release ### [`v3.2.21`](https://github.com/clap-rs/clap/releases/tag/v3.2.21) [Compare Source](https://github.com/clap-rs/clap/compare/v3.2.20...v3.2.21) #### \[3.2.21] - 2022-09-12 ##### Features - `TypedValueParser::map` to allow reusing existing value parsers for other purposes ### [`v3.2.20`](https://github.com/clap-rs/clap/releases/tag/v3.2.20) [Compare Source](https://github.com/clap-rs/clap/compare/v3.2.19...v3.2.20) #### \[3.2.20] - 2022-09-02 ##### Features - `ArgMatches::get_count` help for `ArgAction::Count` - `ArgMatches::get_flag` help for `ArgAction::SetTrue` / `ArgAction::SetFalse` ### [`v3.2.19`](https://github.com/clap-rs/clap/releases/tag/v3.2.19) [Compare Source](https://github.com/clap-rs/clap/compare/v3.2.18...v3.2.19) #### \[3.2.19] - 2022-08-30 ##### Fixes - *(help)* Ensure required arguments for parent commands aren't shown in their subcommands when using `args_conflicts_with_subcommand` ### [`v3.2.18`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#3218---2022-08-29) [Compare Source](https://github.com/clap-rs/clap/compare/v3.2.17...v3.2.18) ##### Fixes - *(help)* `Command::print_help` now respects `Command::colored_help` - *(derive)* Improved error messages ### [`v3.2.17`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#3217---2022-08-12) [Compare Source](https://github.com/clap-rs/clap/compare/v3.2.16...v3.2.17) ##### Fixes - *(derive)* Expose `#[clap(id = ...)]` attribute to match Arg's latest API ### [`v3.2.16`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#3216---2022-07-30) [Compare Source](https://github.com/clap-rs/clap/compare/v3.2.15...v3.2.16) ##### Fixes - Ensure required arguments appear in errors when they are also members of a group ([#&#8203;4004](https://github.com/clap-rs/clap/issues/4004)) ### [`v3.2.15`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#3215---2022-07-25) [Compare Source](https://github.com/clap-rs/clap/compare/v3.2.14...v3.2.15) ##### Features - *(derive)* New `default_values_t` and `default_values_os_t` attributes ### [`v3.2.14`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#3214---2022-07-21) [Compare Source](https://github.com/clap-rs/clap/compare/v3.2.13...v3.2.14) ##### Fixes - A `multiple_values` positional followed by another positional now works with multiple flags ### [`v3.2.13`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#3213---2022-07-19) [Compare Source](https://github.com/clap-rs/clap/compare/v3.2.12...v3.2.13) ##### Documentation - Pulled in tutorials, cookbook, and derive reference into rustdoc ### [`v3.2.12`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#3212---2022-07-14) [Compare Source](https://github.com/clap-rs/clap/compare/v3.2.11...v3.2.12) ##### Fixes - Allow an arg to declare a conflict with a group ### [`v3.2.11`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#3211---2022-07-13) [Compare Source](https://github.com/clap-rs/clap/compare/v3.2.10...v3.2.11) ##### Features - Added `Arg::get_all_short_aliaes` and `Arg::get_all_aliases` ### [`v3.2.10`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#3210---2022-07-12) [Compare Source](https://github.com/clap-rs/clap/compare/v3.2.8...v3.2.10) ##### Fixes - Loosen lifetime on `Command::mut_subcommand` ### [`v3.2.8`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#328---2022-06-30) [Compare Source](https://github.com/clap-rs/clap/compare/v3.2.7...v3.2.8) ##### Features - Added `Command::mut_subcommand` to mirror `Command::mut_arg` ### [`v3.2.7`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#327---2022-06-28) [Compare Source](https://github.com/clap-rs/clap/compare/v3.2.6...v3.2.7) ##### Fixes - Global arguments should override env-sourced arguments ### [`v3.2.6`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#326---2022-06-21) [Compare Source](https://github.com/clap-rs/clap/compare/v3.2.5...v3.2.6) ##### Fixes - Don't panic when parsing `--=` ### [`v3.2.5`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#325---2022-06-15) [Compare Source](https://github.com/clap-rs/clap/compare/v3.2.4...v3.2.5) ##### Fixes - *(derive)* Fix regression with `#[clap(default_value_os_t ...)]` introduced in v3.2.3 ### [`v3.2.4`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#324---2022-06-14) [Compare Source](https://github.com/clap-rs/clap/compare/v3.2.3...v3.2.4) ##### Fixes - *(derive)* Provide more clearer deprecation messages for `#[clap(parse)]` attribute ([#&#8203;3832](https://github.com/clap-rs/clap/issues/3832)) ### [`v3.2.3`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#323---2022-06-14) [Compare Source](https://github.com/clap-rs/clap/compare/v3.2.2...v3.2.3) ##### Fixes - Moved deprecations to be behind the `deprecated` Cargo.toml feature ([#&#8203;3830](https://github.com/clap-rs/clap/issues/3830)) - For now, it is disabled by default though we are considering enabling it by default as we release the next major version to help draw attention to the deprecation migration path ### [`v3.2.2`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#322---2022-06-14) [Compare Source](https://github.com/clap-rs/clap/compare/v3.2.1...v3.2.2) ##### Fixes - *(derive)* Improve the highlighted code for deprecation warnings **gated behind `unstable-v4`** - *(derive)* Default to `#[clap(value_parser, action)]` instead of `#[clap(parse)]` ([#&#8203;3827](https://github.com/clap-rs/clap/issues/3827)) ### [`v3.2.1`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#3218---2022-08-29) [Compare Source](https://github.com/clap-rs/clap/compare/v3.2.0...v3.2.1) ##### Fixes - *(help)* `Command::print_help` now respects `Command::colored_help` - *(derive)* Improved error messages ### [`v3.2.0`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#320---2022-06-13) [Compare Source](https://github.com/clap-rs/clap/compare/v3.1.18...v3.2.0) ##### Compatibility MSRV is now 1.56.0 ([#&#8203;3732](https://github.com/clap-rs/clap/issues/3732)) Behavior - Defaults no longer satisfy `required` and its variants ([#&#8203;3793](https://github.com/clap-rs/clap/issues/3793)) - When misusing `ArgMatches::value_of` and friends, debug asserts were turned into panics Moving (old location deprecated) - `clap::{PossibleValue, ValueHint}` to `clap::builder::{PossibleValue, ValueHint}` - `clap::{Indices, OsValues, ValueSource, Values}` to `clap::parser::{Indices, OsValues, ValueSource, Values}` - `clap::ArgEnum` to `clap::ValueEnum` ([#&#8203;3799](https://github.com/clap-rs/clap/issues/3799)) Replaced - `Arg::allow_invalid_utf8` with `Arg::value_parser(value_parser!(PathBuf))` ([#&#8203;3753](https://github.com/clap-rs/clap/issues/3753)) - `Arg::validator` / `Arg::validator_os` with `Arg::value_parser` ([#&#8203;3753](https://github.com/clap-rs/clap/issues/3753)) - `Arg::validator_regex` with users providing their own `builder::TypedValueParser` ([#&#8203;3756](https://github.com/clap-rs/clap/issues/3756)) - `Arg::forbid_empty_values` with `builder::NonEmptyStringValueParser` / `builder::PathBufValueParser` ([#&#8203;3753](https://github.com/clap-rs/clap/issues/3753)) - `Arg::possible_values` with `Arg::value_parser([...])`, `builder::PossibleValuesParser`, or `builder::EnumValueParser` ([#&#8203;3753](https://github.com/clap-rs/clap/issues/3753)) - `Arg::max_occurrences` with `arg.action(ArgAction::Count).value_parser(value_parser!(u8).range(..N))` for flags ([#&#8203;3797](https://github.com/clap-rs/clap/issues/3797)) - `Arg::multiple_occurrences` with `ArgAction::Append` or `ArgAction::Count` though positionals will need `Arg::multiple_values` ([#&#8203;3772](https://github.com/clap-rs/clap/issues/3772), [#&#8203;3797](https://github.com/clap-rs/clap/issues/3797)) - `Command::args_override_self` with `ArgAction::Set` ([#&#8203;2627](https://github.com/clap-rs/clap/issues/2627), [#&#8203;3797](https://github.com/clap-rs/clap/issues/3797)) - `AppSettings::NoAutoVersion` with `ArgAction` or `Command::disable_version_flag` ([#&#8203;3800](https://github.com/clap-rs/clap/issues/3800)) - `AppSettings::NoHelpVersion` with `ArgAction` or `Command::disable_help_flag` / `Command::disable_help_subcommand` ([#&#8203;3800](https://github.com/clap-rs/clap/issues/3800)) - `ArgMatches::{value_of, value_of_os, value_of_os_lossy, value_of_t}` with `ArgMatches::{get_one,remove_one}` ([#&#8203;3753](https://github.com/clap-rs/clap/issues/3753)) - `ArgMatches::{values_of, values_of_os, values_of_os_lossy, values_of_t}` with `ArgMatches::{get_many,remove_many}` ([#&#8203;3753](https://github.com/clap-rs/clap/issues/3753)) - `ArgMatches::is_valid_arg` with `ArgMatches::{try_get_one,try_get_many}` ([#&#8203;3753](https://github.com/clap-rs/clap/issues/3753)) - `ArgMatches::occurrences_of` with `ArgMatches::value_source` or `ArgAction::Count` ([#&#8203;3797](https://github.com/clap-rs/clap/issues/3797)) - `ArgMatches::is_present` with `ArgMatches::contains_id` or `ArgAction::SetTrue` ([#&#8203;3797](https://github.com/clap-rs/clap/issues/3797)) - `ArgAction::StoreValue` with `ArgAction::Set` or `ArgAction::Append` ([#&#8203;3797](https://github.com/clap-rs/clap/issues/3797)) - `ArgAction::IncOccurrences` with `ArgAction::SetTrue` or `ArgAction::Count` ([#&#8203;3797](https://github.com/clap-rs/clap/issues/3797)) - *(derive)* `#[clap(parse(...))]` replaced with: ([#&#8203;3589](https://github.com/clap-rs/clap/issues/3589), [#&#8203;3794](https://github.com/clap-rs/clap/issues/3794)) - For default parsers (no `parse` attribute), deprecation warnings can be silenced by opting into the new behavior by adding either `#[clap(action)]` or `#[clap(value_parser)]` (ie requesting the default behavior for these attributes). Alternatively, the `unstable-v4` feature changes the default away from `parse` to `action`/`value_parser`. - For `#[clap(parse(from_flag))]` replaced with `#[clap(action = ArgAction::SetTrue)]` ([#&#8203;3794](https://github.com/clap-rs/clap/issues/3794)) - For `#[clap(parse(from_occurrences))]` replaced with `#[clap(action = ArgAction::Count)]` though the field's type must be `u8` ([#&#8203;3794](https://github.com/clap-rs/clap/issues/3794)) - 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 `#[clap(parse(try_from_str = ...)]`, replace it with `#[clap(value_parser = ...)]` - For most other cases, a type implementing `TypedValueParser` will be needed and specify it with `#[clap(value_parser = ...)]` ##### Features - Parsed, typed arguments via `Arg::value_parser` / `ArgMatches::{get_one,get_many}` ([#&#8203;2683](https://github.com/clap-rs/clap/issues/2683), [#&#8203;3732](https://github.com/clap-rs/clap/issues/3732)) - Several built-in `TypedValueParser`s available with an API open for expansion - `value_parser!(T)` macro for selecting a parser for a given type ([#&#8203;3732](https://github.com/clap-rs/clap/issues/3732)) and open to expansion via the `ValueParserFactory` trait ([#&#8203;3755](https://github.com/clap-rs/clap/issues/3755)) - `[&str]` is implicitly a value parser for possible values - All `ArgMatches` getters do not assume required arguments ([#&#8203;2505](https://github.com/clap-rs/clap/issues/2505)) - Add `ArgMatches::remove_*` variants to transfer ownership - Add `ArgMatches::try_*` variants to avoid panics for developer errors ([#&#8203;3621](https://github.com/clap-rs/clap/issues/3621)) - Add a `get_raw` to access the underlying `OsStr`s - `PathBuf` value parsers imply `ValueHint::AnyPath` for completions ([#&#8203;3732](https://github.com/clap-rs/clap/issues/3732)) - Explicit control over parsing via `Arg::action` ([#&#8203;3774](https://github.com/clap-rs/clap/issues/3774)) - `ArgAction::StoreValue`: existing `takes_value(true)` behavior - `ArgAction::IncOccurrences`: existing `takes_value(false)` behavior - `ArgAction::Help`: existing `--help` behavior - `ArgAction::Version`: existing `--version` behavior - `ArgAction::Set`: Overwrite existing values (like `Arg::multiple_occurrences` mixed with `Command::args_override_self`) ([#&#8203;3777](https://github.com/clap-rs/clap/issues/3777)) - `ArgAction::Append`: like `Arg::multiple_occurrences` ([#&#8203;3777](https://github.com/clap-rs/clap/issues/3777)) - `ArgAction::SetTrue`: Treat `--flag` as `--flag=true` ([#&#8203;3775](https://github.com/clap-rs/clap/issues/3775)) - Implies `Arg::default_value("false")` ([#&#8203;3786](https://github.com/clap-rs/clap/issues/3786)) - Parses `Arg::env` via `Arg::value_parser` - `ArgAction::SetFalse`: Treat `--flag` as `--flag=false` ([#&#8203;3775](https://github.com/clap-rs/clap/issues/3775)) - Implies `Arg::default_value("true")` ([#&#8203;3786](https://github.com/clap-rs/clap/issues/3786)) - Parses `Arg::env` via `Arg::value_parser` - `ArgAction::Count`: Treat `--flag --flag --flag` as `--flag=1 --flag=2 --flag=3` ([#&#8203;3775](https://github.com/clap-rs/clap/issues/3775)) - Implies `Arg::default_value("0")` ([#&#8203;3786](https://github.com/clap-rs/clap/issues/3786)) - Parses `Arg::env` via `Arg::value_parser` - *(derive)* Opt-in to new `Arg::value_parser` / `Arg::action` with either `#[clap(value_parser)]` ([#&#8203;3589](https://github.com/clap-rs/clap/issues/3589), [#&#8203;3742](https://github.com/clap-rs/clap/issues/3742)) / `#[clap(action)]` attributes ([#&#8203;3794](https://github.com/clap-rs/clap/issues/3794)) - Default `ValueParser` is determined by `value_parser!` ([#&#8203;3199](https://github.com/clap-rs/clap/issues/3199), [#&#8203;3496](https://github.com/clap-rs/clap/issues/3496)) - Default `ArgAction` is determine by a hard-coded lookup on the type ([#&#8203;3794](https://github.com/clap-rs/clap/issues/3794)) - `Command::multicall` is now stable for busybox-like programs and REPLs ([#&#8203;2861](https://github.com/clap-rs/clap/issues/2861), [#&#8203;3684](https://github.com/clap-rs/clap/issues/3684)) - `ArgMatches::{try_,}contains_id` for checking if there are values for an argument that mirrors the new `get_{one,many}` API ##### Fixes - Don't correct argument id in `default_value_ifs_os`([#&#8203;3815](https://github.com/clap-rs/clap/issues/3815)) *parser* - Set `ArgMatches::value_source` and `ArgMatches::occurrences_of` for external subcommands ([#&#8203;3732](https://github.com/clap-rs/clap/issues/3732)) - Use value delimiter for `Arg::default_missing_values` ([#&#8203;3761](https://github.com/clap-rs/clap/issues/3761), [#&#8203;3765](https://github.com/clap-rs/clap/issues/3765)) - Split`Arg::default_value` / `Arg::env` on value delimiters independent of whether `--` was used ([#&#8203;3765](https://github.com/clap-rs/clap/issues/3765)) - Allow applying defaults to flags ([#&#8203;3294](https://github.com/clap-rs/clap/issues/3294), 3775) - Defaults no longer satisfy `required` and its variants ([#&#8203;3793](https://github.com/clap-rs/clap/issues/3793)) </details> --- ### 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. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4yMzYuNCIsInVwZGF0ZWRJblZlciI6IjM2LjU3LjEwIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIn0=-->
pierre force-pushed renovate/clap-4.x from e2a2442478 to b63f55adcd 2022-11-04 00:37:47 +00:00 Compare
pierre force-pushed renovate/clap-4.x from b63f55adcd to 722b1abe19 2022-11-08 00:32:42 +00:00 Compare
pierre force-pushed renovate/clap-4.x from 722b1abe19 to 276961ad6c 2022-11-12 00:14:13 +00:00 Compare
pierre force-pushed renovate/clap-4.x from 276961ad6c to 45b266f3b0 2022-11-26 00:36:31 +00:00 Compare
pierre force-pushed renovate/clap-4.x from 45b266f3b0 to de54ab68c0 2022-11-30 00:32:33 +00:00 Compare
pierre force-pushed renovate/clap-4.x from de54ab68c0 to 726d8837d9 2022-12-29 00:20:41 +00:00 Compare
pierre force-pushed renovate/clap-4.x from 726d8837d9 to c9caadd869 2023-01-21 00:20:09 +00:00 Compare
pierre force-pushed renovate/clap-4.x from c9caadd869 to 82ae9c0d3c 2023-01-24 00:14:33 +00:00 Compare
pierre force-pushed renovate/clap-4.x from 82ae9c0d3c to 0248d15689 2023-01-26 00:14:48 +00:00 Compare
pierre force-pushed renovate/clap-4.x from 0248d15689 to c0fd659417 2023-02-17 00:23:23 +00:00 Compare
pierre force-pushed renovate/clap-4.x from c0fd659417 to e9c6bb59ce 2023-03-09 00:24:45 +00:00 Compare
pierre force-pushed renovate/clap-4.x from e9c6bb59ce to 6d325d422d 2023-03-16 00:31:13 +00:00 Compare
pierre force-pushed renovate/clap-4.x from 6d325d422d to 373103fd69 2023-04-01 00:07:57 +00:00 Compare
pierre force-pushed renovate/clap-4.x from 373103fd69 to 10527177f6 2023-04-19 00:27:21 +00:00 Compare
pierre force-pushed renovate/clap-4.x from 10527177f6 to 8c46b9d41a 2023-04-26 00:30:35 +00:00 Compare
pierre force-pushed renovate/clap-4.x from 8c46b9d41a to e0d4e19473 2023-04-28 00:24:01 +00:00 Compare
pierre force-pushed renovate/clap-4.x from e0d4e19473 to 5510a9882d 2023-05-16 00:31:39 +00:00 Compare
pierre force-pushed renovate/clap-4.x from 5510a9882d to 460b986f23 2023-05-23 09:51:30 +00:00 Compare
pierre force-pushed renovate/clap-4.x from 460b986f23 to 6ca88f62c4 2023-06-03 00:23:57 +00:00 Compare
pierre force-pushed renovate/clap-4.x from 6ca88f62c4 to 814cabed85 2023-06-06 00:25:35 +00:00 Compare
pierre force-pushed renovate/clap-4.x from 814cabed85 to 09a9366ef0 2023-06-10 00:25:17 +00:00 Compare
pierre force-pushed renovate/clap-4.x from 09a9366ef0 to a9096041be 2023-06-15 00:25:41 +00:00 Compare
pierre force-pushed renovate/clap-4.x from a9096041be to a2bc792936 2023-06-21 00:16:11 +00:00 Compare
pierre force-pushed renovate/clap-4.x from a2bc792936 to a7b5e4eb53 2023-06-24 00:08:12 +00:00 Compare
pierre force-pushed renovate/clap-4.x from a7b5e4eb53 to be6aaffc28 2023-06-29 00:08:11 +00:00 Compare
pierre force-pushed renovate/clap-4.x from be6aaffc28 to 2f618f623b 2023-07-01 00:08:52 +00:00 Compare
pierre force-pushed renovate/clap-4.x from 2f618f623b to 1e45bc860a 2023-07-06 00:09:08 +00:00 Compare
pierre force-pushed renovate/clap-4.x from 1e45bc860a to 0db754fa49 2023-07-15 00:15:08 +00:00 Compare
pierre force-pushed renovate/clap-4.x from 0db754fa49 to bd0f7d9e6b 2023-07-18 00:15:58 +00:00 Compare
pierre force-pushed renovate/clap-4.x from bd0f7d9e6b to 32637b4681 2023-07-19 00:15:19 +00:00 Compare
pierre force-pushed renovate/clap-4.x from 32637b4681 to e4937c7a48 2023-07-20 00:15:55 +00:00 Compare
pierre force-pushed renovate/clap-4.x from e4937c7a48 to 1a93754e71 2023-07-22 00:37:42 +00:00 Compare
pierre force-pushed renovate/clap-4.x from 1a93754e71 to 6219cc4986 2023-08-09 00:28:54 +00:00 Compare
pierre force-pushed renovate/clap-4.x from 6219cc4986 to 072018525b 2023-08-18 00:28:44 +00:00 Compare
pierre force-pushed renovate/clap-4.x from 072018525b to e8eaae4a07 2023-08-19 00:29:08 +00:00 Compare
pierre force-pushed renovate/clap-4.x from e8eaae4a07 to b51ac05716 2023-08-25 00:39:58 +00:00 Compare
Author
Owner

Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.

You can manually request rebase by checking the rebase/retry box above.

⚠️ Warning: custom changes will be lost.

### Edited/Blocked Notification Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR. You can manually request rebase by checking the rebase/retry box above. ⚠️ **Warning**: custom changes will be lost.
This pull request can be merged automatically.
You are not authorized to merge this pull request.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin renovate/clap-4.x:renovate/clap-4.x
git checkout renovate/clap-4.x
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: pierre/PagesServer#9
No description provided.