clap-rs v3.0.0-beta.2 Release Notes

Release Date: 2020-09-18 // 2 months ago
  • ๐Ÿ’ฅ BREAKING CHANGES

    • โœ‚ Removed
      • From<&yaml_rust::yaml::Hash> for ArgGroup
      • App
      • App::write_version in favor of write!(w, App::render_version)
      • App::write_long_version in favor of write!(w, App::render_long_version)
      • Error
      • Error::cause in favor of <Error as Display>::to_string
      • Macros
      • _clap_count_exprs!
    • ๐Ÿ“‡ Renamed Methods
      • App
      • App::set_term_width => App::term_width
      • Arg
      • Arg::from_yaml => Arg::from
      • Arg::with_name => Arg::new
      • Arg::required_if => Arg::required_if_eq
      • Arg::required_ifs => Arg::required_if_eq_any
      • Arg::required_unless => Arg::required_unless_present
      • Arg::required_unless_one => Arg::required_unless_present_any
      • Arg::required_unless_all => Arg::required_unless_present_all
      • ArgGroup
      • ArgGroup::from_yaml => ArgGroup::from
      • ArgGroup::with_name => ArgGroup::new
    • ๐Ÿ“‡ Renamed Variants
      • ErrorKind
      • ErrorKind::HelpDisplayed => ErrorKind::DisplayHelp
      • ErrorKind::VersionDisplayed => ErrorKind::DisplayVersion
    • ๐Ÿ”„ Changed
      • App::print_help & App::print_long_help now return std::io::Result
      • App::write_help & App::write_long_help now return std::io::Result
      • Error::info now is of type Vec<String> instead of Option<Vec<String>>
      • ArgMatches::subcommand now returns Option<(&str, &ArgMatches)>
      • short in #[clap()] now accepts char instead of &str

    ๐Ÿ”‹ Features

    • โž• Added support for subcommands that are flags (pacman style)
    • โž• Added Indices that is returned by ArgMatches::indices_of
    • โž• Added @global_setting for app's macro builder
    • โž• Added Methods
      • Arg
      • Arg::default_missing_value
      • Arg::default_missing_value_os
      • Arg::default_missing_values
      • Arg::default_missing_values_os
      • Arg::short_alias
      • Arg::short_aliases
      • Arg::visible_short_alias
      • Arg::visible_short_aliases
      • Arg::value_hint
      • Arg::validator_regex (gated behind regex feature)
      • App
      • App::subcommand_placeholder
      • App::before_long_help
      • App::after_long_help
    • TODO: List App::get_* methods

    โœจ Enhancements

    • help_heading defined on Arg now has higher priority than App
    • 0๏ธโƒฃ Limited default text wrapping to 100 when wrap_help feature is not enabled
    • ๐Ÿ›  Multiple bug fixes and error message improvements
    • ๐ŸŽ Size and Performance improvements

Previous changes from v3.0.0-beta.1

  • Minimum Required Rust

    • ๐Ÿš€ As of this release, clap requires rustc 1.40.0 or greater.

    ๐Ÿ’ฅ BREAKING CHANGES

    • โœ‚ Removed
      • SubCommand in favor of App
      • SubCommand::with_name => App::new
      • SubCommand::from_yaml => App::from
      • App
      • App::with_defaults
      • App::version_message in favor of App::mut_arg
      • App::version_short in favor of App::mut_arg
      • App::help_message in favor of App::mut_arg
      • App::help_short in favor of App::mut_arg
      • App::arg_from_usage in favor of App::arg
      • App::args_from_usage in favor of App::args(usage.lines().map(|l| l.trim()).filter(|l| !l.is_empty()))
      • App::gen_completions in favor of TODO:
      • App::gen_completions_to in favor of TODO:
      • App::settings in favor of App::setting(Setting1 | Setting2)
      • App::unset_settings in favor of App::unset_setting(Setting1 | Setting2)
      • App::global_settings in favor of App::global_setting(Setting1 | Setting2)
      • Arg
      • Arg::empty_values in favor of TODO:
      • ArgMatches
      • ArgMatches::usage in favor of App::generate_usage
      • Macros
      • arg_enum! in favor of ArgEnum derive macro.
      • value_t! in favor of ArgMatches::value_of_t
      • value_t_or_exit! in favor of ArgMatches::value_of_t_or_exit
      • values_t! in favor of ArgMatches::values_of_t
      • values_t_or_exit! in favor of ArgMatches::values_of_t_or_exit
    • โœ‚ Removed Settings
      • AppSettings::PropagateGlobalValuesDown
      • ArgSettings::Global in favor of Arg::global method
      • ArgSettings::Multiple in favor of ArgSettings::MultipleValues and ArgSettings::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 accepts char instead of &str
      • Arg::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>
    • โœ‚ Removed support for {n} in help text
    • ๐Ÿ“œ In usage parser, for options [name]... --option [val] results in ArgSettings::MultipleOccurrences but --option [val]... results in ArgSettings::MultipleValues and ArgSettings::MultipleOccurrences. Before both resulted in the same thing
    • App and Arg now need only one lifetime
    • ๐Ÿ‘ Allowing empty values is no longer the default
    • 0๏ธโƒฃ UseValueDelimiter is no longer the default
    • App::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
    • โž• Added Settings
      • AppSettings::HelpRequired
      • AppSettings::NoAutoHelp
      • AppSettings::NoAutoVersion
      • ArgSettings::SubcommandPrecedenceOverArg

    โœจ Enhancements

    • Made App::arg and App::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