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 requires rustc 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 of App
      • 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 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
      • 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)
      • 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 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 (changed again in 3.0.0-beta.4)

    • 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
      • Arg::settings (changed again in 3.0.0-beta.4)
    • โž• 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