Update Rust crate clap to v4 #9
Reference in New Issue
Block a user
No description provided.
Delete Branch "renovate/clap-4.x"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR contains the following updates:
3.1.8->4.4.0Release Notes
clap-rs/clap (clap)
v4.4.0Compare Source
Compatibility
v4.3.24Compare Source
Fixes
--helpwith custom templatesv4.3.23Compare Source
Fixes
UnknownArgumentValueParserto not error on flag's absencev4.3.22Compare Source
Features
UnknownArgumentValueParserfor injecting errors for improving the experience with errorsv4.3.21Compare Source
Features
TryMapValueParserso the type can be namedv4.3.20Compare Source
Features
Command::mut_argsfor modifying all arguments en massev4.3.19Compare Source
Fixes
value_terminatoreven in the presence of later multiple-value positional argumentsv4.3.18Compare Source
Fixes
--in fewer places where it won't workv4.3.17Compare Source
Fixes
PossibleValuedescriptions in--helpv4.3.16Compare Source
Fixes
v4.3.15Compare Source
Features
anstyleDocumentation
v4.3.14Compare Source
Features
ArgAction::HelpShortandArgAction::HelpLongfor explicitly specifying which style of help to displayFixes
[OPTIONS]in usage if a help or versionArgActionis usedv4.3.13Compare Source
v4.3.12Compare Source
Fixes
v4.3.11Compare Source
Features
num::Wrapping,Box, orArcBox<str>,Box<OsStr>, andBox<Path>v4.3.10Compare Source
Performance
v4.3.9Compare Source
Fixes
Command::ignore_errorsno longer masks help/versionv4.3.8Compare Source
Fixes
infer_long_arg, rather than arbitrarily picking one, matching the documentation and subcommand's behaviorv4.3.7Compare Source
Documentation
v4.3.6Compare Source
Documentation
cliov4.3.5Compare Source
ColorChoice::possible_valuesis added to simplify things for builder usersFixes
ColorChoice::to_possible_valueno longer includes descriptions, encouraging shorter help where possiblev4.3.4Compare Source
Features
Error::exit_codev4.3.3Compare Source
Features
Command::deferfor delayed initialization of subcommands to reduce startup times of large applications like denov4.3.2Compare Source
Fixes
--helpwith custom templatesv4.3.1Compare Source
Fixes
value_terminatoreven in the presence of later multiple-value positional argumentsv4.3.0Compare Source
Fixes
lastassertionvalue_terminatorhas higher precedence thanallow_hyphen_values--helpv4.2.7Compare Source
Fixes
ArgMatchesv4.2.6Compare Source
Features
impl Eq<std::any::TypeId> for clap_builder::util::AnyValueIdv4.2.5Compare Source
Fixes
v4.2.4Compare Source
Documentation
Command::stylev4.2.3Compare Source
Features
Command::stylesfor theming help/errors (behindunstable-styles)v4.2.2Compare Source
Internal
v4.2.1Compare Source
Fixes
v4.2.0Compare Source
Compatibility
unstable-replacefeature (open to discussion at #2836)unstable-groupedfeatureFeatures
StyledStrto accept text styled with ANSI escape codesCLICOLOR,CLICOLOR_FORCEFixes
v4.1.14Compare Source
Features
#[group]raw attribute supportPerformance
clap_builderwas pulled out ofclapso it could build in parallel toclap_deriveos_str_bytesdependency was removed for faster builds and smaller binariesv4.1.13Compare Source
Performance
Commandv4.1.12Compare Source
Internal
synv2Performance
proc-macro-errordependencyv4.1.11Compare Source
Internal
bitflagsv4.1.10Compare Source
Fixes
v4.1.9Compare Source
Fixes
get_count/get_flagv4.1.8Compare Source
Fixes
denylints on the users behalfv4.1.7Compare Source
Fixes
v4.1.6Compare Source
Fixes
--helpjust because hidden possible values include a descriptionv4.1.5Compare Source
Fixes
--helpjust because a hidden arg has a possible value with a descriptionv4.1.4Compare Source
Fixes
disable_colored_helpwhen usingarg_required_else_helpPerformance
arg!macrov4.1.3Compare Source
Fixes
subcommands, rather thansubcommandv4.1.2Compare Source
Fixes
get_flag, rather thanget_one::<bool>v4.1.1Compare Source
Features
#[group]raw attribute supportPerformance
clap_builderwas pulled out ofclapso it could build in parallel toclap_deriveos_str_bytesdependency was removed for faster builds and smaller binariesv4.1.0Compare Source
Compatibility
MSRV changed to 1.64.0
For apps with custom
--helpand--versionflags:--helpand--versionchangedWhen apps have errors imitating clap's error style:
Features
ArgMatches::get_occurrencessupport for argument values to be grouped by their occurrenceFixes
upgrade_fromwhen arguments / subcommands are explicitly marked as required--helpand--version(also helps with overflow)v4.0.32Compare Source
Fixes
required(true), consider args that conflict with its groupv4.0.31Compare Source
Performance
v4.0.30Compare Source
Fixes
args_conflicts_with_subcommandv4.0.29Compare Source
v4.0.28Compare Source
Fixes
v4.0.27Compare Source
Features
Arg::value_parseracceptVec<impl Into<PossibleValue>>DisplayandFromStrforColorChoiceFixes
attytois-terminalv4.0.26Compare Source
Fixes
ContextKind::as_strv4.0.25Compare Source
Features
v4.0.24Compare Source
Fixes
v4.0.23Compare Source
Fixes
helpsubcommandv4.0.22Compare Source
Fixes
v4.0.21Compare Source
Features
long_aboutandlong_helpattributes, 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.20Compare Source
Fixes
v4.0.19Compare Source
Features
ColorChoicenow implementsValueEnumv4.0.18Compare Source
Fixes
#[command(skip)]to also work with enum variants with a valuev4.0.17Compare Source
Fixes
Arg::last(true)withArg::value_hint(ValueHint::CommandWithArguments)v4.0.16Compare Source
Fixes
Arg::exclusive(true)should not be exclusive with the argument's ownArgGroupv4.0.15Compare Source
Fixes
--when it doesn't helpv4.0.14Compare Source
Fixes
ArgGroupinArgMatcheswhen explicitly specified, fixing derives handling of option-flattened fields (#4375)v4.0.13Compare Source
Features
()for fields to mean "don't read" (#4371)v4.0.12Compare Source
Features
TypedValueParser::try_mapfor when adapting an existingTypedValueParsercan failError::new,Error::with_cmd, andError::insertv4.0.11Compare Source
Fixes
v4.0.10Compare Source
Features
#[arg(flatten)]onOptiontypes (#4211, #4350)v4.0.9Compare Source
Fixes
#[command(subcommand)]like in clap v3v4.0.8Compare Source
Fixes
HelpandVersionactionsv4.0.7Compare Source
Features
Fixes
#[group(skip)]onParserderivev4.0.6Compare Source
Features
#[group(skip)](#4279, #4301)v4.0.5Compare Source
v4.0.4Compare Source
Fixes
v4.0.3Compare Source
Fixes
required(true), consider args that conflict with its groupv4.0.2Compare Source
v4.0.1Compare Source
Features
ColorChoicenow implementsValueEnumv4.0.0Compare 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_argswhich accepts bothsingle values and ranges of values.
num_argscontrols how many raw argumentson 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
--helpoutput to make sure it ismeeting that goal.
In doing this evaluation, we wanted to keep in mind:
Before:
After:
--versionis available for showing the same thing (if the program has a version set)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
&strfor performance but this can makedealing with owned data difficult, like
#[arg(default_value_t)]generating aString from the default value.
Additionally, to avoid
ArgMatchesfrom borrowing (and for some features wedecided to forgo), clap took the
&strargument IDs and hashed them. Thisprevented 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, orBox<str>for dynamic behavior with small binary size.As an extension of that work, you can now call
ArgMatches::idsto iterateover the arguments and groups that were found when parsing. The newtype
Idwas 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:
ArgActionValueParserAPIPathBuf(allowing invalid UTF-8)AppSettingsandArgSettingsenums with getters/settersMigrating
Steps:
-hand--helpoutput at a minimum (recommendation: trycmd for snapshot testing)arg.action(ArgAction::...)on each argument (StoreValuefor options andIncOccurrencesfor flags)cargo check --features clap/deprecatedand resolve all deprecation warningsdefault-features = false, runcargo add clap -F help,usage,error-contextcargo add clap -F wrap_helpunless you want to hard code line wrapsExample test (derive):
Example test (builder):
Note: the idiomatic / recommended way of specifying different types of args in the Builder API has changed:
Before
After:
In particular,
num_args(the replacement fortakes_value) will default appropriatelyfrom the
ArgActionand generally only needs to be set explicitly for theother
num_argsuse cases.Breaking Changes
Subtle changes (i.e. compiler won't catch):
arg!now sets one of (#3795):ArgAction::SetTrue, requiringArgMatches::get_flaginstead ofArgMatches::is_presentArgAction::Count, requiringArgMatches::get_countinstead ofArgMatches::occurrences_ofArgAction::Set, requiringArgMatches::get_oneinstead ofArgMatches::value_ofArgAction::Append, requiringArgMatches::get_manyinstead ofArgMatches::values_ofArgAction::Set,ArgAction::SetTrue, andArg::Action::SetFalsenowconflict by default to be like
ArgAction::StoreValueandArgAction::IncOccurrences, requiringcmd.args_override_self(true)to override instead (#4261)Args default action isArgAction::Set, rather thanArgAction::IncOccurrenceto reduce confusing magic through consistency (#2687, #4032, see also #3977)mut_argcan 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)Command,Arg,ArgGroup, andPossibleValue, assuming'static.stringfeature flag will enable support forStrings (#1041, #2150, #4223)arg!(--flag <value>)is now optional, instead of required. Add.required(true)at the end to restore the original behavior (#4206)help,usageanderror-context, requiring adding them back in ifdefault-features = false(#4236)""argument for external subcommands to make it easier to distinguish them from built-in commands (#3263)Arg::allow_hyphen_values, to be consistent withCommand::allow_hyphen_values(#4187)Arg::value_terminatormust be its own argument on the CLI rather than being in a delimited list (#4025)wrap_helpfeature flag, either enable it or hard code your wraps (#4258)DeriveDisplayOrderthe default and removed the setting. To sort help, setnext_display_order(None)(#2808)Command::next_display_orderinstead ofDeriveDisplayOrderand using its own initial display order value (#2808)Command::help_template(#4132)Command::help_template,Arg::help_heading, andCommand::subcommand_help_heading(#4132)COMMANDfor the value name. To get the old behavior, seeCommand::subcommand_help_headingandArg::subcommand_value_name(#4132, #4155)Command::help_template. (#4132, #4160)--helpand--versionlike anyArgAction::SetTrueflag (#3776)Arg::idasverbatimcasing, requiring updating of string references to other args like inconflicts_withorrequires(#3282)ValueEnumvariants will now show up in--help(#3312)Args, andArgGroupis created using the type's name, reserving it for future use (#2621, #4209)next_help_headingcan now leak out of a#[clap(flatten)], like all other command settings (#4222)Easier to catch changes:
ArgMatchesnow returns the argIds, rather than the values to reduce overhead and offer more flexibility. (#4072)Arg::number_of_values(average-across-occurrences) toArg::num_args(per-occurrence) (raw CLI args, not parsed values) (#2688, #4023)num_args(0)no longer impliestakes_value(true).multiple_values(true)(#4023)num_args(1)no longer impliesmultiple_values(true)(#4023)Arg::min_values(across all occurrences) withArg::num_args(N..)(per occurrence) to reduce confusion over different value count APIs (#4023)Arg::max_values(across all occurrences) withArg::num_args(1..=M)(per occurrence) to reduce confusion over different value count APIs (#4023)Arg::multiple_values(true)withArg::num_args(1..)andArg::multiple_values(false)withArg::num_args(0)to reduce confusion over different value count APIs (#4023)Arg::takes_value(true)withArg::num_args(1)andArg::takes_value(false)withArg::num_args(0)to reduce confusion over different value count APIsArg::require_value_delimiter, either users could useArg::value_delimiteror implement a custom parser withTypedValueParseras it was mostly to makemultiple_values(true)act likemultiple_values(false)and isn't needed anymore (#4026)Arg::new("help")andArg::new("version")no longer implicitly disable thebuilt-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 asglobal(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 ownArg::new("help").long("help").action(ArgAction::Help).global(true). (#4056)ArgAction::SetTrueandArgAction::SetFalsenow prioritizeArg::default_missing_valueover their standard behavior (#4000)Arg::requires_ifsandArg::default_value*_ifs*to taking anArgPredicate, removing ambiguity withNonewhen accepting owned and borrowed types (#4084)PartialEqandEqfromCommandso we could change external subcommands to use aValueParser(#3990)Arg,Command, andArgGroupcalls were switched from accepting&[]to[]viaIntoIteratorto be more flexible (#4072)Arg::short_aliasesand other builder functions that took&[]need the&dropped (#4081)ErrorKindandResultmoved into theerrormoduleErrorKind::EmptyValuereplaced withErrorKind::InvalidValueto remove an unnecessary special case (#3676, #3968)ErrorKind::UnrecognizedSubcommandreplaced withErrorKind::InvalidSubcommandto remove an unnecessary special case (#3676)allow_external_subcommandsfromStringtoOsStringas that is less likely to cause bugs in user applications (#3990)Command::render_usagenow returns aStyledStr(#4248)parsetovalue_parser, removingparsesupport (#3827, #3981)#[clap(value_parser)]and#[clap(action)]are now redundantsubcommand_required(true).arg_required_else_help(true)is set instead ofSubcommandRequiredElseHelpto give more meaningful errors when subcommands are missing and to reduce redundancy (#3280)arg_enumattribute in favor ofvalue_enumto match the new name (we didn't have support in v3 to mark it deprecated) (#4127)Arg::default_missing_valuedidn't requirenum_args(0..=N), now it does (#4023)Arg::longare no longer allowed (#3691)value_namesthannum_args(#2695)ArgAction::Versionis used#[track_caller]s to make it easier to debug assertsoverrides_withIDs are validoverrides_withnow that Actions replace itmut_argreceiving an invalid arg ID ormut_subcommandreceiving an invalid command nameCompatibility
MSRV is now 1.60.0
Deprecated
Arg::use_value_delimiterin favor ofArg::value_delimiterto avoid having multiple ways of doing the same thingArg::requires_allin favor ofArg::requires_ifsnow that it takes anArgPredicateto avoid having multiple ways of doing the same thingArg::number_of_valuesin favor ofArg::num_argsto clarify semantic differencesdefault_value_os,default_values_os,default_value_if_os, anddefault_value_ifs_osas the non_osvariants now accept either astror anOsStr(#4141)Arg::env_osin favor ofArg::envCommand::dont_collapse_args_in_usageis now the default (#4151)Command::trailing_var_argin favor ofArg::trailing_var_argto make it clearer which arg it is meant to apply to (#4187)Command::allow_hyphen_valuesin favor ofArg::allow_hyphen_valuesto make it clearer which arg it is meant to apply to (#4187)Command::allow_negative_numbersin favor ofArg::allow_negative_numbersto make it clearer which arg it is meant to apply to (#4187)Command::write_helpandCommand::write_long_helpin favor ofCommand::render_helpandCommand::render_long_help(#4248)structoptandclapattributes in favor of the more specificcommand,arg, andvalueto open the door for more features and clarify relationship to the builder (#1807, #4180)#[clap(value_parser)]and#[clap(action)]defaulted attributes (its the default) (#3976)Behavior Changes
wrap_helpfeature, if the terminal size cannot be determined,LINESandCOLUMNSvariables are used (#4186)Features
Arg::num_argsnow accepts ranges, allowing setting both the minimum and maximum number of values per occurrence (#2688, #4023)value_parsers forArgAction::SetTrue/ArgAction::SetFalse(#4092)From<&OsStr>,From<OsString>,From<&str>, andFrom<String>tovalue_parser!(#4257)Command,Arg,ArgGroup,PossibleValue, etc without managing lifetimes with thestringfeature flag (#2150, #4223)error-context,helpandusagefeature flags that can be turned off for smaller binaries (#4236)StyledStr::ansi()toDisplaywith ANSI escape codes (#4248)Error::applyfor changing the formatter for dropping binary size (#4111)Error::renderfor formatting the error into aStyledStrPossibleValue::helpin long help (--help) (#3312){tab}variable forCommand::help_template(#4161)Command::render_helpandCommand::render_long_helpfor formatting the error into aStyledStr(#3873, #4248)Command::render_usagenow returns aStyledStr(#4248)Fixes
requiredis not used with conditional required settings (#3660)cmd.allow_invalid_for_utf8_external_subcommandswithcmd.external_subcommand_value_parser(#3733)Arg::default_missing_valuenow applies per occurrence rather than if a value is missing across all occurrences (#3998)arg!(--long [value])to accept0..=1per occurrence rather than across all occurrences, making it safe to use withArgAction::Append(#4001)OsStrs forArg::{required_if_eq,required_if_eq_any,required_if_eq_all}(#4084)wrap_helpfeature, if the terminal size cannot be determined,LINESandCOLUMNSvariables are used (#4186)Command::display_namein the help title rather thanCommand::bin_nameArgAction::Countby adding an...(#4003)cmd help help(#4131)[positional]in list when relevant (#4144)[positional]in usage (#4151)-h/--helpwhen applicable (#4132, #4159)next_line_help, don't add blank lines (#4132, #4190)Command::display_namerather thanCommand::bin_name(#3966)""argument for external subcommands (#3263)Arg::allow_hyphen_values, likeCommand::allow_hyphen_values(#4187)InvalidSubcommandoverUnknownArgumentin more cases (#4219)Arg::idasverbatimcasing (#3282)#[clap(value_parser, action)]instead of#[clap(parse)](#3827)v3.2.25Compare Source
[3.2.25] - 2023-04-27
Fixes
v3.2.24Compare Source
[3.2.24] - 2023-04-25
Fixes
v3.2.23Compare Source
[3.2.23] - 2022-10-24
Fixes
textwrap0.16v3.2.22Compare Source
[3.2.22] - 2022-09-16
Fixes
terminal_sizeto the 0.2 releasev3.2.21Compare Source
[3.2.21] - 2022-09-12
Features
TypedValueParser::mapto allow reusing existing value parsers for other purposesv3.2.20Compare Source
[3.2.20] - 2022-09-02
Features
ArgMatches::get_counthelp forArgAction::CountArgMatches::get_flaghelp forArgAction::SetTrue/ArgAction::SetFalsev3.2.19Compare Source
[3.2.19] - 2022-08-30
Fixes
args_conflicts_with_subcommandv3.2.18Compare Source
Fixes
Command::print_helpnow respectsCommand::colored_helpv3.2.17Compare Source
Fixes
#[clap(id = ...)]attribute to match Arg's latest APIv3.2.16Compare Source
Fixes
v3.2.15Compare Source
Features
default_values_tanddefault_values_os_tattributesv3.2.14Compare Source
Fixes
multiple_valuespositional followed by another positional now works with multiple flagsv3.2.13Compare Source
Documentation
v3.2.12Compare Source
Fixes
v3.2.11Compare Source
Features
Arg::get_all_short_aliaesandArg::get_all_aliasesv3.2.10Compare Source
Fixes
Command::mut_subcommandv3.2.8Compare Source
Features
Command::mut_subcommandto mirrorCommand::mut_argv3.2.7Compare Source
Fixes
v3.2.6Compare Source
Fixes
--=v3.2.5Compare Source
Fixes
#[clap(default_value_os_t ...)]introduced in v3.2.3v3.2.4Compare Source
Fixes
#[clap(parse)]attribute (#3832)v3.2.3Compare Source
Fixes
deprecatedCargo.toml feature (#3830)default as we release the next major version to help draw attention to the
deprecation migration path
v3.2.2Compare Source
Fixes
gated behind
unstable-v4#[clap(value_parser, action)]instead of#[clap(parse)](#3827)v3.2.1Compare Source
Fixes
Command::print_helpnow respectsCommand::colored_helpv3.2.0Compare Source
Compatibility
MSRV is now 1.56.0 (#3732)
Behavior
requiredand its variants (#3793)ArgMatches::value_ofand friends, debug asserts were turned into panicsMoving (old location deprecated)
clap::{PossibleValue, ValueHint}toclap::builder::{PossibleValue, ValueHint}clap::{Indices, OsValues, ValueSource, Values}toclap::parser::{Indices, OsValues, ValueSource, Values}clap::ArgEnumtoclap::ValueEnum(#3799)Replaced
Arg::allow_invalid_utf8withArg::value_parser(value_parser!(PathBuf))(#3753)Arg::validator/Arg::validator_oswithArg::value_parser(#3753)Arg::validator_regexwith users providing their ownbuilder::TypedValueParser(#3756)Arg::forbid_empty_valueswithbuilder::NonEmptyStringValueParser/builder::PathBufValueParser(#3753)Arg::possible_valueswithArg::value_parser([...]),builder::PossibleValuesParser, orbuilder::EnumValueParser(#3753)Arg::max_occurrenceswitharg.action(ArgAction::Count).value_parser(value_parser!(u8).range(..N))for flags (#3797)Arg::multiple_occurrenceswithArgAction::AppendorArgAction::Countthough positionals will needArg::multiple_values(#3772, #3797)Command::args_override_selfwithArgAction::Set(#2627, #3797)AppSettings::NoAutoVersionwithArgActionorCommand::disable_version_flag(#3800)AppSettings::NoHelpVersionwithArgActionorCommand::disable_help_flag/Command::disable_help_subcommand(#3800)ArgMatches::{value_of, value_of_os, value_of_os_lossy, value_of_t}withArgMatches::{get_one,remove_one}(#3753)ArgMatches::{values_of, values_of_os, values_of_os_lossy, values_of_t}withArgMatches::{get_many,remove_many}(#3753)ArgMatches::is_valid_argwithArgMatches::{try_get_one,try_get_many}(#3753)ArgMatches::occurrences_ofwithArgMatches::value_sourceorArgAction::Count(#3797)ArgMatches::is_presentwithArgMatches::contains_idorArgAction::SetTrue(#3797)ArgAction::StoreValuewithArgAction::SetorArgAction::Append(#3797)ArgAction::IncOccurrenceswithArgAction::SetTrueorArgAction::Count(#3797)#[clap(parse(...))]replaced with: (#3589, #3794)parseattribute), deprecation warnings can besilenced by opting into the new behavior by adding either
#[clap(action)]or
#[clap(value_parser)](ie requesting the default behavior for theseattributes). Alternatively, the
unstable-v4feature changes the defaultaway from
parsetoaction/value_parser.#[clap(parse(from_flag))]replaced with#[clap(action = ArgAction::SetTrue)](#3794)#[clap(parse(from_occurrences))]replaced with#[clap(action = ArgAction::Count)]though the field's type must beu8(#3794)#[clap(parse(from_os_str)]forPathBuf, replace it with#[clap(value_parser)](as mentioned earlier this will callvalue_parser!(PathBuf)which will auto-select the rightValueParserautomatically).
#[clap(parse(try_from_str = ...)], replace it with#[clap(value_parser = ...)]TypedValueParserwill be needed and specify it with#[clap(value_parser = ...)]Features
Arg::value_parser/ArgMatches::{get_one,get_many}(#2683, #3732)TypedValueParsers available with an API open for expansionvalue_parser!(T)macro for selecting a parser for a given type (#3732) and open to expansion via theValueParserFactorytrait (#3755)[&str]is implicitly a value parser for possible valuesArgMatchesgetters do not assume required arguments (#2505)ArgMatches::remove_*variants to transfer ownershipArgMatches::try_*variants to avoid panics for developer errors (#3621)get_rawto access the underlyingOsStrsPathBufvalue parsers implyValueHint::AnyPathfor completions (#3732)Arg::action(#3774)ArgAction::StoreValue: existingtakes_value(true)behaviorArgAction::IncOccurrences: existingtakes_value(false)behaviorArgAction::Help: existing--helpbehaviorArgAction::Version: existing--versionbehaviorArgAction::Set: Overwrite existing values (likeArg::multiple_occurrencesmixed withCommand::args_override_self) (#3777)ArgAction::Append: likeArg::multiple_occurrences(#3777)ArgAction::SetTrue: Treat--flagas--flag=true(#3775)Arg::default_value("false")(#3786)Arg::envviaArg::value_parserArgAction::SetFalse: Treat--flagas--flag=false(#3775)Arg::default_value("true")(#3786)Arg::envviaArg::value_parserArgAction::Count: Treat--flag --flag --flagas--flag=1 --flag=2 --flag=3(#3775)Arg::default_value("0")(#3786)Arg::envviaArg::value_parserArg::value_parser/Arg::actionwith either#[clap(value_parser)](#3589, #3742) /#[clap(action)]attributes (#3794)ValueParseris determined byvalue_parser!(#3199, #3496)ArgActionis determine by a hard-coded lookup on the type (#3794)Command::multicallis now stable for busybox-like programs and REPLs (#2861, #3684)ArgMatches::{try_,}contains_idfor checking if there are values for an argument that mirrors the newget_{one,many}APIFixes
default_value_ifs_os(#3815)parser
ArgMatches::value_sourceandArgMatches::occurrences_offor external subcommands (#3732)Arg::default_missing_values(#3761, #3765)Arg::default_value/Arg::envon value delimiters independent of whether--was used (#3765)requiredand its variants (#3793)v3.1.18Compare Source
Fixes
arg_enum!for users migrating to clap3 (#3717)required_unless_present_allarguments exist...when not enoughvalue_namesare suppliedgated behind
unstable-v4requiredis not used with conditional required settings (#3660)value_namesthannumber_of_values(#2695)""argument for external subcommands (#3263)Arg::idasverbatimcasing (#3282)v3.1.17Compare Source
Fixes
arg!macro to have dashes when quoted, like longsv3.1.16Compare Source
Fixes
Arg::exclusiveoverridesArg::required, like other conflictshelp_templatevariable{name}to fix problems with{bin}gated behind
unstable-v4Arg::longare no longer allowedCommand::display_namein the help title rather thanCommand::bin_namev3.1.15Compare Source
Fixes
v3.1.14Compare Source
Fixes
Command::buildwith a required positional argument nested several layers in subcommandsv3.1.13Compare Source
Fixes
Command::write_helpnow report required arguments in usage in more circumstancesdebugfeaturecolorfeature withdebugfeature enabledv3.1.12Compare Source
Fixes
v3.1.11Compare Source
Fixes
Arg::required, making the behavior consistent with how we calculate conflicts for error reportingArgGroupoverrideArg::required, making the behavior consistent with how we calculate conflicts for error reportingArg::overrides_withalways overrideArg::required, not just when the parser processes an overridev3.1.10Compare Source
Features
Command::buildfor custom help generation or other command introspection needsv3.1.9Compare Source
Fixes
clap_deriveversion so a compatible version is always used withclapConfiguration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Renovate Bot.
7b962b4bbcto28a07131d828a07131d8to90725b11ff90725b11fftoc5af4f6204c5af4f6204to796c21970f796c21970ftoa76dd2b0b6a76dd2b0b6toddb3405d0bddb3405d0bto88015bffab88015bffabto7c37dc51927c37dc5192to399e3f60ad399e3f60adto1cddad56841cddad5684to9d9f5118f99d9f5118f9to72333cf7c272333cf7c2todc37496d93dc37496d93to1ef3fefd8d1ef3fefd8dto61b598479e61b598479etoc61d8edca9c61d8edca9to7c00f854db7c00f854dbtoa5c0b2a7e5a5c0b2a7e5to2a232810972a23281097tod10022eac9d10022eac9toe7d4c6de45e7d4c6de45to9971194d199971194d19to60f46cc64a60f46cc64atocdc391bf0fcdc391bf0ftoa38dfa91f0a38dfa91f0to2d5eaa357c2d5eaa357cto78fff25f9378fff25f93to4b50feaa5a4b50feaa5ato0a15531dd80a15531dd8to3447876ec63447876ec6to9d99a269fb9d99a269fbto5acc4b6aff5acc4b6afftoe10bd61187e10bd61187to5810e903ecEdited/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.
5810e903ecto932e0d51ff932e0d51ffto4cfafa3910Pull request closed