NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io · #784 most downloaded on crates.io
Generate shell completion scripts for your clap::Command
Last release 19 days ago
15 Sep 2026
Ships fairly regularly
a new release about every 4 weeks
Nearly every release is documented
notes for 59 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
5 years old
134 releases · first in 2021
One column per quarter.
*(help)* Show PossibleValue::help in long help (--help) (gated behind `unstable-v4`)
PossibleValue::help in long help (--help) (gated behind unstable-v4) (#3312)Don't panic when validating delimited defaults
unstable-dynamic feature flag*(derive)* Allow other attribute with a subcommand that has subcommands
Track caller for ArgMatches assertions so the user more easily sees where they need to fix the call
ArgMatches assertions so the user more easily sees where they need to fix the call*(help)* help subcommand shows long help like --help, rather than short help (-h), deprecated clap::AppSettings::UseLongFormatForHelpSubcommand
Changes in behavior of note that are not guaranteed to be compatible across releases:
help subcommand shows long help like --help, rather than short help (-h), deprecated clap::AppSettings::UseLongFormatForHelpSubcommand (#3440)clap::Command is now preferred over clap::App (#3089 in #3472)
clap::command! is now preferred over clap::app_from_crate (#3089 in #3474)clap::CommandFactory::command is now preferred over clap::IntoApp::into_app (#3089 in #3473)help subcommand shows long help like --help, rather than short help (-h), deprecated clap::AppSettings::UseLongFormatForHelpSubcommand (#3440)clap::AppSettings::WaitOnError, leaving it to the user to implementclap::Command::subcommand_required(true).arg_required_else_help(true) is now preferred over clap::AppSettings::SubcommandRequiredElseHelp (#3280)clap::AppSettings are nearly all deprecated and replaced with builder methods and getters (#2717)clap::ArgSettings is deprecated and replaced with builder methods and getters (#2717)clap::Arg::id and clap::ArgGroup::id are now preferred over clap::Arg::name and clap::ArgGroup::name (#3335)clap::Command::next_help_heading is now preferred over clap::Command::help_heading (#1807, #1553)clap::error::ErrorKind is now preferred over clap::ErrorKind (#3395)clap::Error::kind() is now preferred over clap::Error::kindclap::Error::context() is now preferred over clap::Error::info (#2628)Note: All items deprecated in 3.0.0 are now hidden in the documentation. (#3458)
clap::ArgMatches::value_source to determine what insert the value (#1345)clap::Command::next_display_order (#1807)clap::Error::context API to open the door for fully-custom error messages (#2628)
clap::error::ErrorKind now implements Displayclap::Command::color to override previous calls (#3449)ArgRequiredElseHelp precedence over SubcommandRequired (#3456)clap::Command::arg_required_else_help, etc (#3076, #1264)-h conflicts (#3403)--help (#1549)clap::error::Result (#3395)clap::Error (#3395)clap::Arg::validatorparse attributeDon't assume user does use clap::ArgEnum
derive
use clap::ArgEnum (#3277)List correct replacement for deprecated Parser::from_clap
docs:
ArgMatches assertsParser::from_clap (#3257)For very limited cases, like cargo, expose ArgMatches::is_valid_arg to avoid panicing on undefined arguments
cargo, expose ArgMatches::is_valid_arg to avoid panicing on undefined argumentsSpecify cause of debug assert failure
Ignore Last when checking hyphen values (see #3249 for details)
Last when checking hyphen values (see #3249 for details)#[must_use]Don't panic when getting number of values
default_value_t derive attribute with a Subcommand (#3245)Documentation
name attribute to ArgEnum variant derive reference<!-- next-url --> [Unreleased]: https://github.com/clap-rs/clap/compare/clap_complete-v4.6.11...HEAD [4.6.11]: https://github.com/clap-rs/clap/compare/clap_complete-v4.6.10...clap_complete-v4.6.11 [4.6.10]: https://github.com/clap-rs/clap/compare/clap_complete-v4.6.9...clap_complete-v4.6.10 [4.6.9]: https://github.com/clap-rs/clap/compare/clap_complete-v4.6.8...clap_complete-v4.6.9 [4.6.8]: https://github.com/clap-rs/clap/compare/clap_complete-v4.6.7...clap_complete-v4.6.8 [4.6.7]: https://github.com/clap-rs/clap/compare/clap_complete-v4.6.6...clap_complete-v4.6.7 [4.6.6]: https://github.com/clap-rs/clap/compare/clap_complete-v4.6.5...clap_complete-v4.6.6 [4.6.5]: https://github.com/clap-rs/clap/compare/clap_complete-v4.6.4...clap_complete-v4.6.5 [4.6.4]: https://github.com/clap-rs/clap/compare/clap_complete-v4.6.3...clap_complete-v4.6.4 [4.6.3]: https://github.com/clap-rs/clap/compare/clap_complete-v4.6.2...clap_complete-v4.6.3 [4.6.2]: https://github.com/clap-rs/clap/compare/clap_complete-v4.6.1...clap_complete-v4.6.2 [4.6.1]: https://github.com/clap-rs/clap/compare/clap_complete-v4.6.0...clap_complete-v4.6.1 [4.6.0]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.67...clap_complete-v4.6.0 [4.5.67]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.66...clap_complete-v4.5.67 [4.5.66]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.65...clap_complete-v4.5.66 [4.5.65]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.64...clap_complete-v4.5.65 [4.5.64]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.63...clap_complete-v4.5.64 [4.5.63]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.62...clap_complete-v4.5.63 [4.5.62]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.61...clap_complete-v4.5.62 [4.5.61]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.60...clap_complete-v4.5.61 [4.5.60]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.59...clap_complete-v4.5.60 [4.5.59]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.58...clap_complete-v4.5.59 [4.5.58]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.57...clap_complete-v4.5.58 [4.5.57]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.56...clap_complete-v4.5.57 [4.5.56]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.55...clap_complete-v4.5.56 [4.5.55]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.54...clap_complete-v4.5.55 [4.5.54]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.53...clap_complete-v4.5.54 [4.5.53]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.52...clap_complete-v4.5.53 [4.5.52]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.51...clap_complete-v4.5.52 [4.5.51]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.50...clap_complete-v4.5.51 [4.5.50]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.49...clap_complete-v4.5.50 [4.5.49]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.48...clap_complete-v4.5.49 [4.5.48]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.47...clap_complete-v4.5.48 [4.5.47]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.46...clap_complete-v4.5.47 [4.5.46]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.45...clap_complete-v4.5.46 [4.5.45]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.44...clap_complete-v4.5.45 [4.5.44]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.43...clap_complete-v4.5.44 [4.5.43]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.42...clap_complete-v4.5.43 [4.5.42]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.41...clap_complete-v4.5.42 [4.5.41]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.40...clap_complete-v4.5.41 [4.5.40]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.39...clap_complete-v4.5.40 [4.5.39]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.38...clap_complete-v4.5.39 [4.5.38]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.37...clap_complete-v4.5.38 [4.5.37]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.36...clap_complete-v4.5.37 [4.5.36]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.35...clap_complete-v4.5.36 [4.5.35]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.34...clap_complete-v4.5.35 [4.5.34]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.33...clap_complete-v4.5.34 [4.5.33]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.32...clap_complete-v4.5.33 [4.5.32]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.31...clap_complete-v4.5.32 [4.5.31]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.30...clap_complete-v4.5.31 [4.5.30]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.29...clap_complete-v4.5.30 [4.5.29]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.28...clap_complete-v4.5.29 [4.5.28]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.27...clap_complete-v4.5.28 [4.5.27]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.26...clap_complete-v4.5.27 [4.5.26]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.25...clap_complete-v4.5.26 [4.5.25]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.24...clap_complete-v4.5.25 [4.5.24]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.23...clap_complete-v4.5.24 [4.5.23]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.22...clap_complete-v4.5.23 [4.5.22]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.21...clap_complete-v4.5.22 [4.5.21]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.20...clap_complete-v4.5.21 [4.5.20]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.19...clap_complete-v4.5.20 [4.5.19]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.18...clap_complete-v4.5.19 [4.5.18]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.17...clap_complete-v4.5.18 [4.5.17]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.16...clap_complete-v4.5.17 [4.5.16]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.15...clap_complete-v4.5.16 [4.5.15]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.14...clap_complete-v4.5.15 [4.5.14]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.13...clap_complete-v4.5.14 [4.5.13]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.12...clap_complete-v4.5.13 [4.5.12]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.11...clap_complete-v4.5.12 [4.5.11]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.10...clap_complete-v4.5.11 [4.5.10]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.9...clap_complete-v4.5.10 [4.5.9]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.8...clap_complete-v4.5.9 [4.5.8]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.7...clap_complete-v4.5.8 [4.5.7]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.6...clap_complete-v4.5.7 [4.5.6]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.5...clap_complete-v4.5.6 [4.5.5]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.4...clap_complete-v4.5.5 [4.5.4]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.3...clap_complete-v4.5.4 [4.5.3]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.2...clap_complete-v4.5.3 [4.5.2]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.1...clap_complete-v4.5.2 [4.5.1]: https://github.com/clap-rs/clap/compare/clap_complete-v4.5.0...clap_complete-v4.5.1 [4.5.0]: https://github.com/clap-rs/clap/compare/clap_complete-v4.4.10...clap_complete-v4.5.0 [4.4.10]: https://github.com/clap-rs/clap/compare/clap_complete-v4.4.9...clap_complete-v4.4.10 [4.4.9]: https://github.com/clap-rs/clap/compare/clap_complete-v4.4.8...clap_complete-v4.4.9 [4.4.8]: https://github.com/clap-rs/clap/compare/clap_complete-v4.4.7...clap_complete-v4.4.8 [4.4.7]: https://github.com/clap-rs/clap/compare/clap_complete-v4.4.6...clap_complete-v4.4.7 [4.4.6]: https://github.com/clap-rs/clap/compare/clap_complete-v4.4.5...clap_complete-v4.4.6 [4.4.5]: https://github.com/clap-rs/clap/compare/clap_complete-v4.4.4...clap_complete-v4.4.5 [4.4.4]: https://github.com/clap-rs/clap/compare/clap_complete-v4.4.3...clap_complete-v4.4.4 [4.4.3]: https://github.com/clap-rs/clap/compare/clap_complete-v4.4.2...clap_complete-v4.4.3 [4.4.2]: https://github.com/clap-rs/clap/compare/clap_complete-v4.4.1...clap_complete-v4.4.2 [4.4.1]: https://github.com/clap-rs/clap/compare/clap_complete-v4.4.0...clap_complete-v4.4.1 [4.4.0]: https://github.com/clap-rs/clap/compare/clap_complete-v4.3.2...clap_complete-v4.4.0 [4.3.2]: https://github.com/clap-rs/clap/compare/clap_complete-v4.3.1...clap_complete-v4.3.2 [4.3.1]: https://github.com/clap-rs/clap/compare/clap_complete-v4.3.0...clap_complete-v4.3.1 [4.3.0]: https://github.com/clap-rs/clap/compare/clap_complete-v4.2.3...clap_complete-v4.3.0 [4.2.3]: https://github.com/clap-rs/clap/compare/clap_complete-v4.2.2...clap_complete-v4.2.3 [4.2.2]: https://github.com/clap-rs/clap/compare/clap_complete-v4.2.1...clap_complete-v4.2.2 [4.2.1]: https://github.com/clap-rs/clap/compare/clap_complete-v4.2.0...clap_complete-v4.2.1 [4.2.0]: https://github.com/clap-rs/clap/compare/clap_complete-v4.1.6...clap_complete-v4.2.0 [4.1.6]: https://github.com/clap-rs/clap/compare/clap_complete-v4.1.5...clap_complete-v4.1.6 [4.1.5]: https://github.com/clap-rs/clap/compare/clap_complete-v4.1.4...clap_complete-v4.1.5 [4.1.4]: https://github.com/clap-rs/clap/compare/clap_complete-v4.1.3...clap_complete-v4.1.4 [4.1.3]: https://github.com/clap-rs/clap/compare/clap_complete-v4.1.2...clap_complete-v4.1.3 [4.1.2]: https://github.com/clap-rs/clap/compare/clap_complete-v4.1.1...clap_complete-v4.1.2 [4.1.1]: https://github.com/clap-rs/clap/compare/clap_complete-v4.1.0...clap_complete-v4.1.1 [4.1.0]: https://github.com/clap-rs/clap/compare/clap_complete-v4.0.7...clap_complete-v4.1.0 [4.0.7]: https://github.com/clap-rs/clap/compare/clap_complete-v4.0.6...clap_complete-v4.0.7 [4.0.6]: https://github.com/clap-rs/clap/compare/clap_complete-v4.0.5...clap_complete-v4.0.6 [4.0.5]: https://github.com/clap-rs/clap/compare/clap_complete-v4.0.4...clap_complete-v4.0.5 [4.0.4]: https://github.com/clap-rs/clap/compare/clap_complete-v4.0.3...clap_complete-v4.0.4 [4.0.3]: https://github.com/clap-rs/clap/compare/clap_complete-v4.0.2...clap_complete-v4.0.3 [4.0.2]: https://github.com/clap-rs/clap/compare/clap_complete-v4.0.1...clap_complete-v4.0.2 [4.0.1]: https://github.com/clap-rs/clap/compare/clap_complete-v4.0.0...clap_complete-v4.0.1 [4.0.0]: https://github.com/clap-rs/clap/compare/clap_complete-v3.2.3...clap_complete-v4.0.0 [3.2.3]: https://github.com/clap-rs/clap/compare/clap_complete-v3.2.2...clap_complete-v3.2.3 [3.2.2]: https://github.com/clap-rs/clap/compare/clap_complete-v3.2.1...clap_complete-v3.2.2 [3.2.1]: https://github.com/clap-rs/clap/compare/clap_complete-v3.2.0...clap_complete-v3.2.1 [3.2.0]: https://github.com/clap-rs/clap/compare/clap_complete-v3.1.4...clap_complete-v3.2.0 [3.1.4]: https://github.com/clap-rs/clap/compare/clap_complete-v3.1.3...clap_complete-v3.1.4 [3.1.3]: https://github.com/clap-rs/clap/compare/clap_complete-v3.1.2...clap_complete-v3.1.3 [3.1.2]: https://github.com/clap-rs/clap/compare/clap_complete-v3.1.1...clap_complete-v3.1.2 [3.1.1]: https://github.com/clap-rs/clap/compare/clap_complete-v3.1.0...clap_complete-v3.1.1 [3.1.0]: https://github.com/clap-rs/clap/compare/clap_complete-v3.0.6...clap_complete-v3.1.0 [3.0.6]: https://github.com/clap-rs/clap/compare/clap_complete-v3.0.5...clap_complete-v3.0.6 [3.0.5]: https://github.com/clap-rs/clap/compare/clap_complete-v3.0.4...clap_complete-v3.0.5 [3.0.4]: https://github.com/clap-rs/clap/compare/clap_complete-v3.0.3...clap_complete-v3.0.4 [3.0.3]: https://github.com/clap-rs/clap/compare/v3.0.2...clap_complete-v3.0.3 [3.0.2]: https://github.com/clap-rs/clap/compare/v3.0.1...v3.0.2 [3.0.1]: https://github.com/clap-rs/clap/compare/v3.0.0...v3.0.1
Look over the "subtle changes" under BREAKING CHANGES
Note: clap v3 has been in development for several years and has changed hands multiple times. Unfortunately, our changelog might be incomplete, whether in changes or their motivation.
A special thanks to the maintainers, contributors, beta users, and sponsors who have helped along this journey, especially kbknapp.
StructOpt Integration
StructOpt provides a serde-like declarative approach to defining your parser. The main benefits we've seen so far from integrating are:
StructOpt traits so crates built on clap3 can be
reused not just with other derives but also people using the builder API.
People can even hand implement these so people using the builder API won't
have the pay the cost for derives.Custom Help Headings
Previously, clap automatically grouped arguments in the help as either
ARGS, FLAGS, OPTIONS, and SUBCOMMANDS.
You can now override the default group with Arg::help_heading and
App::subcommand_help_heading. To apply a heading to a series of arguments,
you can set App::help_heading.
Deprecations
While a lot of deprecations have been added to clean up the API (overloaded
meaning of Arg::multiple) or make things more consistent, some particular
highlights are:
clap_app! has been deprecated in favor of the builder API with arg! (clap-rs/clap#2835)Arg::from_usage has been deprecated in favor of arg! (clap-rs/clap#3087)
From clap v2
-h and --help output at a minimum (recommendation: trycmd for snapshot testing)no-default-features: add the std featureApp creation to a function and add a test similar to the one below, resolving any of its assertionsArgMatches asserts regarding AllowInvalidUtf8.Example test:
fn app() -> clap::App<'static> {
...
}
#[test]
fn verify_app() {
app().debug_assert();
}
From structopt 0.3.25 <a name="migrate-structopt"></a>
-h and --help output at a minimum (recommendation: trycmd for snapshot testing)structopt = "..." to clap = { version = "3.0", features = ["derive"] }
no-default-features: add the std featureuse statements from structopt and structopt::clap to clapExample test:
#[derive(clap::StructOpt)]
struct Args {
...
}
#[test]
fn verify_app() {
use clap::IntoApp;
Args::into_app().debug_assert()
}
From clap v3.0.0-beta.5
-h and --help output at a minimum (recommendation: trycmd for snapshot testing)derive, env, cargo, or unicode feature flags as neededyaml, clap_app!, or usage parser: revert any changes you made for clap3Arg::about Arg::long_about back to help and long_help and change PossibleValue::about to help (clap-rs/clap#3075)AppSettings::HelpRequired to AppSettings::HelpExpectedPossibleValue::hidden to PossibleValue::hideApp::subcommand_placeholder to App::subcommand_value_name / App::subcommand_help_headingderive: see the structopt breaking changes section for Vec changesArgMatches asserts regarding AllowInvalidUtf8.From clap 2
Subtle changes (i.e. compiler won't catch):
AppSettings::UnifiedHelpMessage is now default behaviour
{flags} and {unified} will assert if present in App::help_templateAppSettings::EnableColoredHelp is now the default behavior but can be
opted-out with AppSettings::DisableColoredHelp
(clap-rs/clap#2806)App::override_usage no longer implies a leading \t, allowing multi lined usagesArg::require_equals no longer implies ArgSettings::ForbidEmptyValues (#2233)Arg::require_delimiter no longer implies ArgSettings::TakesValue and ArgSettings::UseValueDelimiter (#2233)Arg::env, Arg::env_os, Arg::last, Arg::require_equals, Arg::allow_hyphen_values,
Arg::hide_possible_values, Arg::hide_default_value, Arg::hide_env_values,
Arg::case_insensitive and Arg::multiple_values no longer imply ArgSettings::TakesValue (#2233)ArgMatches::is_present no longer checks subcommand names...s meaning in usage parser. Before, it always meant multiple which is still true for --option [val].... Now [name]... --option [val] results in ArgSettings::MultipleOccurrences.1 to 2 (clap-rs/clap#1327)--foo=bar when takes_value(false) (clap-rs/clap#1543)- for long arguments (-----long)Easier to catch changes:
no-default-features, you now have to specify the std feature (reserved for future work)env feature flag
Arg::env, Arg::env_os, Arg::hide_env_values, ArgSettings::HideEnvValuescargo feature flag
crate_name!, crate_version!, crate_authors!, crate_description!, app_from_crate!AppSettings::StrictUtf8 is now default behaviour and asserts if
AppSettings::AllowInvalidUtf8ForExternalSubcommands and
ArgSettings::AllowInvalidUtf8 and ArgMatches::value_of_os aren't used
together
AppSettings::AllowInvalidUtf8 has been removedArg::short and Arg::value_delimiter now take a char instead of a &strArgMatches panics on unknown argumentsVersionlessSubcommands, making it the default (see clap-rs/clap#2812)ArgSettings::EmptyValues in favor of ArgSettings::ForbidEmptyValuesArg::validator now takes first argument as Fn(&str) -> Result<O, E: ToString> instead of
Fn(String) -> Result<(), String>Arg::validator_os now takes first argument as Fn(&OsStr) -> Result<O, OsString> instead of
Fn(&OsStr) -> Result<(), OsString>Arg::value_name now sets, rather than appends (see clap-rs/clap#2634)yaml-rust from 0.3 to 0.4ArgGroup::from(BTreeMap) to ArgGroup::from(yaml)ArgMatches::usage with App::generate_usageArg::settings with Arg::setting(Setting1 | Setting2)App and Arg now need only one lifetimeApp::with_defaults, replaced with app_from_crateAppSettings::PropagateGlobalValuesDown (now the default)App functions, like App::write_help now take &mut self instead of &selfError::message is now private, use Error::to_stringArg::default_value_if, Arg::default_value_if_os, Arg::default_value_ifs,
Arg::default_value_ifs_os now takes the default value parameter as an option (clap-rs/clap#1406)App::print_help & App::print_long_help to now return std::io::ResultApp::write_help & App::write_long_help to now return std::io::ResultArg::index, Arg::number_of_values, Arg::min_values, Arg::max_values to taking usize instead of u64Error::info to type Vec<String> instead of Option<Vec<String>>ArgMatches::subcommand to now return Option<(&str, &ArgMatches)>ErrorKind::MissingArgumentOrSubcommand to ErrorKind::DisplayHelpOnMissingArgumentOrSubcommandErrorKind::HelpDisplayed to ErrorKind::DisplayHelpErrorKind::VersionDisplayed to ErrorKind::DisplayVersion#[non_exhaustive] to clap::{ValueHint, ErrorKind, AppSettings, ArgSettings} (clap-rs/clap#3167)From structopt 0.3.25
App isn't initialized with crate information anymore. Now opt-in via #[clap(author)], #[clap(about)], #[clap(version)] (clap-rs/clap#3034)#[clap(default_value)] is replaced with #[clap(default_value_t)] (clap-rs/clap#1694)#[clap(subcommand)] attribute (clap-rs/clap#2587)Vec<_> and Option<Vec<_>> have changed from multiple to multiple_occurrencesOn top of the clap 2 changes
From clap 2
unicode feature flag for faster builds and smaller binaries for ASCII-only CLIs.env feature flag for faster builds and smaller binaries.From clap 2
Integration of structopt::StructOpt via clap::Parser (requires derive feature flag)
Custom help headings
App::help_heading (apply to all future args)Arg::help_heading (apply to current arg)App::subcommand_help_heading along with App::subcommand_value_name (apply to subcommands)AppSettings::UnifiedHelpMessage is now default behaviour (clap-rs/clap#2807)Deriving of ArgEnum for generating Arg::possible_values (requires derive feature flag)
Disable built-in help/version behavior with AppSettings::NoAutoHelp and AppSettings::NoAutoVersion
Change an existing arg with new builder method mut_arg (particularly helpful for --help and --version)
Provide extra context in long help messages (--help) with before_long_help and after_long_help (clap-rs/clap#1903)
Detect missing help descriptions via debug asserts by enabling AppSettings::HelpExpected
Aliases for short flags (clap-rs/clap#1896)
Validate UTF-8 values, rather than panicing during ArgMatches::value_of thanks to AppSettings::AllowInvalidUtf8ForExternalSubcommands and ArgSettings::AllowInvalidUtf8
ArgMatches calls do not match the UTF-8 setting.clap::PossibleValue to allow
Allow arguments to conflict with all others via Arg::exclusive (clap-rs/clap#1583)
Validate arguments with a regex (required regex feature flag)
Arg::default_missing_value for cases like --color[=<WHEN>] (clap-rs/clap#1587)
clap::App::color / clap::ColorChoice to specify color setting for the app
Custom error reporting with App::error
App::debug_assert test helper
Replace Arg::multiple(bool) with Arg::multiple_values / Arg::multiple_occurrences
Added support for flag subcommands like pacman (clap-rs/clap#1361)
Partial parsing via AppSettings::IgnoreErrors (clap-rs/clap#1880)
Enable cmd help to print long help (--help instead of -h) with AppSettings::UseLongFormatForHelpSubcommand (clap-rs/clap#2435)
Allow long arg abbreviations like we do with subcommands via AppSettings::InferLongArgs (clap-rs/clap#2435)
Detect subcommands among positional arguments with AppSettings::SubcommandPrecedenceOverArg
Give completion scripts hints with Arg::value_hint (clap-rs/clap#1793)
Allow unsetting defaults with
Arg::default_value_if, Arg::default_value_if_os, Arg::default_value_ifs,
Arg::default_value_ifs_os (clap-rs/clap#1406)
Interpret some env variable values as false for flags, in addition to "not-present" (clap-rs/clap#2539)
n, no, f, false, off, 0Added arg! macro for creating an Arg from a compile-time usage parser
(Experimental) Busybox-like multi-call support
AppSettings::Multicall behind unstable-multicall feature flag(Experimental) Alias an argument to anything group of arguments
App::replace behind unstable-replace feature flag(Experimental) Grouping of multiple values within multiple occurrences
ArgMatches::grouped_values_of behind unstable-grouped feature flagFrom structopt 0.3.25
default_value_t [= <expr>] attribute (clap-rs/clap#1694)update APIarg_enum attribute for integrating with ArgEnum traitOn top of the clap 2 changes
From clap 2
App::version, App::long_version are set
(see clap-rs/clap#2812)wrap_help feature is not enabledArg::multiple with Arg::multiple_values and Arg::multiple_occurrencesapp_from_crate! defaults to separating multiple authors with ", "IgnoreCase is now unicode aware (requires unicode feature flag)ColorChoice::Never, even if that means we skip colors in some casesArgMatches panics on unknown argumentsauthors field in Cargo.toml with app_from_crate--help in cmd help with DisableHelpFlag (clap-rs/clap#3169)--help in cmd help help that doesn't work (clap-rs/clap#3169)From structopt 0.3.25
SubcommandsNegateReqs by allowing required Option<_>s (clap-rs/clap#2255)AllowInvalidUtf8 based on parser (clap-rs/clap#751)authors field in Cargo.tomldefault_value_os but treat it like default_value (clap-rs/clap#3031)flatten and subcommand, ensure our doc comment always overrides the nested container's doc comment, whether it has only about or about and long_about (clap-rs/clap#3175)On top of the clap 2 changes
clap requires rustc 1.54.0 or greater.Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →