[3.1.0] - 2022-02-16
Compatibility
Changes in behavior of note that are not guaranteed to be compatible across releases:
- (help)
helpsubcommand shows long help like--help, rather than short help (-h), deprecatedclap::AppSettings::UseLongFormatForHelpSubcommand(#3440) - (help) Pacman-style subcommands are now ordered the same as usage errors (#3470)
- (help) Pacman-style subcommands use standard alternate syntax in usage (#3470)
Deprecations
clap::Commandis now preferred overclap::App(#3089 in #3472)- (help)
helpsubcommand shows long help like--help, rather than short help (-h), deprecatedclap::AppSettings::UseLongFormatForHelpSubcommand(#3440) - (error) Deprecate
clap::AppSettings::WaitOnError, leaving it to the user to implement - (validation)
clap::Command::subcommand_required(true).arg_required_else_help(true)is now preferred overclap::AppSettings::SubcommandRequiredElseHelp(#3280) - (builder)
clap::AppSettingsare nearly all deprecated and replaced with builder methods and getters (#2717) - (builder)
clap::ArgSettingsis deprecated and replaced with builder methods and getters (#2717) - (builder)
clap::Arg::idandclap::ArgGroup::idare now preferred overclap::Arg::nameandclap::ArgGroup::name(#3335) - (help)
clap::Command::next_help_headingis now preferred overclap::Command::help_heading(#1807, #1553) - (error)
clap::error::ErrorKindis now preferred overclap::ErrorKind(#3395) - (error)
clap::Error::kind()is now preferred overclap::Error::kind - (error)
clap::Error::context()is now preferred overclap::Error::info(#2628)
Note: All items deprecated in 3.0.0 are now hidden in the documentation. (#3458)
Features
- (matches) Add
clap::ArgMatches::value_sourceto determine what insert the value (#1345) - (help) Override derived display order with
clap::Command::next_display_order(#1807) - (error) Show possible values when an argument doesn't have a value (#3320)
- (error) New
clap::Error::contextAPI to open the door for fully-custom error messages (#2628)- (error)
clap::error::ErrorKindnow implementsDisplay
- (error)
Fixes
- (builder) Some functions were renamed for consistency and fixing spelling issues
- (builder) Allow
clap::Command::colorto override previous calls (#3449) - (parse) Propagate globals with multiple subcommands (#3428)
- (validation) Give
ArgRequiredElseHelpprecedence overSubcommandRequired(#3456) - (validation) Default values no longer count as "present" for conflicts, requires,
clap::Command::arg_required_else_help, etc (#3076, #1264) - (assert) Report invalid defaults (#3202)
- (help) Clarify how to handle
-hconflicts (#3403) - (help) Make it easier to debug the addition of help flags (#3425)
- (help) Pacman-style subcommands are now separated with spaces (#3470)
- (help) Pacman-style subcommands are now ordered the same as usage errors (#3470)
- (help) Pacman-style subcommands use standard alternate syntax in usage (#3470)
- (error) Be consistent in showing of required attributes between errors / usage (#3390)
- (error) Show user's order of possible values, like in
--help(#1549) - (error) Allow customizing error type in
clap::error::Result(#3395)
Performance
- (error) Reduced stack size of
clap::Error(#3395)
Documentation
- (builder) Correct data take accepted for
clap::Arg::validator - (derive) Clarify
parseattribute - (tutorial) Demonstrate custom parsing
- (example) Consistently list out required feature flags (#3448)