clap-rs v3.0.0-beta.1 Release Notes
Release Date: 2020-05-03 // almost 4 years ago-
Minimum Required Rust
- ๐ As of this release,
clap
requiresrustc 1.40.0
or greater.
๐ฅ BREAKING CHANGES
โ Added
std
,cargo
,derive
features.Gated behind
cargo
:- Macros
crate_name!
crate_version!
crate_authors!
crate_description!
app_from_crate!
โ Removed
SubCommand
in favor ofApp
SubCommand::with_name
=>App::new
SubCommand::from_yaml
=>App::from
Shell
(changed again in 3.0.0-beta.4)- App
App::with_defaults
App::version_message
in favor ofApp::mut_arg
App::version_short
in favor ofApp::mut_arg
App::help_message
in favor ofApp::mut_arg
App::help_short
in favor ofApp::mut_arg
App::arg_from_usage
in favor ofApp::arg
App::args_from_usage
in favor ofApp::args
App::settings
in favor ofApp::setting(Setting1 | Setting2)
App::unset_settings
in favor ofApp::unset_setting(Setting1 | Setting2)
App::global_settings
in favor ofApp::global_setting(Setting1 | Setting2)
App::gen_completions
in favor of TODO:App::gen_completions_to
in favor of TODO:- Arg
Arg::empty_values
in favor of TODO:- ArgMatches
ArgMatches::usage
in favor ofApp::generate_usage
- Macros
arg_enum!
in favor ofArgEnum
derive macro.value_t!
in favor ofArgMatches::value_of_t
value_t_or_exit!
in favor ofArgMatches::value_of_t_or_exit
values_t!
in favor ofArgMatches::values_of_t
values_t_or_exit!
in favor ofArgMatches::values_of_t_or_exit
โ Removed Settings
AppSettings::PropagateGlobalValuesDown
ArgSettings::Global
in favor ofArg::global
methodArgSettings::Multiple
in favor ofArgSettings::MultipleValues
andArgSettings::MultipleOccurrences
๐ Renamed Methods
- App
App::from_yaml
=>App::from
App::arg_from_usage
=>App::arg
App::help
=>App::override_help
App::usage
=>App::override_usage
App::template
=>App::help_template
App::get_matches_safe
=>App::try_get_matches
App::get_matches_from_safe
=>App::try_get_matches_from
App::get_matches_from_safe_borrow
=>App::try_get_matches_from_mut
- Arg
Arg::help
=>Arg::about
Arg::from_usage
=>Arg::from
Arg::set
=>Arg::setting
Arg::unset
=>Arg::unset_setting
๐ Renamed Settings
ArgSettings::CaseInsensitive
=>ArgSettings::IgnoreCase
ArgSettings::AllowLeadingHyphen
=>ArgSettings::AllowHyphenValues
ArgSettings::EmptyValues
=>ArgSettings::AllowEmptyValues
๐ Renamed Fields
Error::message
=>Error::cause
๐ Changed
App::write_help
is now a mutable reference instance method (takes&mut self
)Arg::short
now acceptschar
instead of&str
Arg::validator
now takes first argument asFn(&str) -> Result<O, E: ToString>
instead ofFn(String) -> Result<(), String>
Arg::validator_os
now takes first argument asFn(&OsStr) -> Result<O, OsString>
instead ofFn(&OsStr) -> Result<(), OsString>
โ Removed support for
{n}
in help text๐ In usage parser, for options
[name]... --option [val]
results inArgSettings::MultipleOccurrences
but--option [val]...
results inArgSettings::MultipleValues
andArgSettings::MultipleOccurrences
. Before both resulted in the same thing.App
andArg
now need only one lifetime๐ Allowing empty values is no longer the default (changed again in 3.0.0-beta.4)
0๏ธโฃ
UseValueDelimiter
is no longer the defaultApp::override_usage
no longer implies\t
which allows multi lined usages
๐ Features
- โ Added Methods
- App
App::replace
App::get_matches_mut
App::mut_arg
App::unset_global_setting
App::help_heading
App::stop_custom_headings
- Arg
Arg::exclusive
Arg::multiple_values
Arg::multiple_occurrences
Arg::help_heading
Arg::settings
(changed again in 3.0.0-beta.4)
- โ Added Settings
AppSettings::HelpRequired
AppSettings::NoAutoHelp
AppSettings::NoAutoVersion
ArgSettings::SubcommandPrecedenceOverArg
โจ Enhancements
- Made
App::arg
andApp::args
more generic - ๐ Improvements to
clap_app!
macro to make it support more wider use cases - ๐ Colors now work correctly on Windows Console
- ๐ Multiple bug fixes and error message improvements
- ๐ Improvements to parsing logic and help messages
- ๐ As of this release,