Update changelog

This commit is contained in:
Pavan Kumar Sunkara 2021-08-14 22:46:49 +01:00
parent c15b894e80
commit a9b86ecefc
3 changed files with 48 additions and 21 deletions

View file

@ -2,7 +2,6 @@
TODO: Structopt and traits
TODO: `YamlLoader`
TODO: `cargo`, `std` features
<a name="v3.0.0-rc.0"></a>
## v3.0.0-rc.0
@ -12,6 +11,16 @@ TODO: `cargo`, `std` features
#### BREAKING CHANGES
Added `unicode_help`, `env` features.
* **Gated behind `env`**:
* **Arg**
* `Arg::env`
* `Arg::env_os`
* `Arg::hide_env_values`
* **ArgSettings**
* `ArgSettings::HideEnvValues`
* **Removed Methods**
* **Arg**
* `Arg::settings` in favor of `Arg::setting(Setting1 | Setting2)`
@ -26,16 +35,24 @@ TODO: `cargo`, `std` features
* **Changed**
* Allowing empty values is the default again with `ArgSettings::AllowEmptyValues` changing to
`ArgSettings::ForbidEmptyValues`
* `AppSettings::GlobalVersion` renamed to `AppSettings::PropagateVersion` and it is not applied
globally anymore
* `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` does not set `ArgSettings::TakesValue` anymore
* `Arg::require_delimiter` does not set `ArgSettings::TakesValue` and `ArgSettings::UseValueDelimiter` anymore
* `Arg::require_delimiter` does not set `ArgSettings::TakesValue` and `ArgSettings::UseValueDelimiter`
anymore
* `Arg::require_equals` does not disallow empty values anymore
* `Arg::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
* `Arg::index`, `Arg::number_of_values`, `Arg::min_values`, `Arg::max_values` now takes `usize`
* `Arg::value_delimiter` now accepts `char` instead of `&str`
* `ArgMatches::is_present` does not handle subcommand names anymore
* Some env var values are considered the same as env var not being present when the arg does not have
`ArgSettings::TakesValue`
* `clap_generate::generate_to` now returns `Result<PathBuf, io::Error>`
* `@group` in `clap_app!` now needs `:` instead of `=>`
* `app` and `arg` objects in `yaml` now allow unknown keys if `_has_metadata` is set
#### Features
@ -44,13 +61,14 @@ TODO: `cargo`, `std` features
* **Added Methods**
* **App**
* `App::license`
* `App::get_long_about`
* `App::get_env`
* `App::get_default_values`
* **Arg**
* `Arg::get_long_about`
* `Arg::get_env`
* `Arg::get_default_values`
* `Arg::hide_env`
* `Arg::required_if_eq_all`
* `Arg::forbid_empty_values`
* `Arg::max_occurrences`
* **ArgMatches**
* `ArgMatches::grouped_values_of`
* **Macros**
@ -59,6 +77,8 @@ TODO: `cargo`, `std` features
* `Error::print`
* **Added Settings**
* `AppSettings::UseLongFormatForHelpSubcommand`
* `AppSettings::IgnoreErrors`
* `AppSettings::InferLongArgs`
* `ArgSettings::HideEnv`
#### Enhancements
@ -146,11 +166,21 @@ TODO: `cargo`, `std` features
#### 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-rc.0)
* `Shell` (changed again in 3.0.0-beta.3)
* **App**
* `App::with_defaults`
* `App::version_message` in favor of `App::mut_arg`
@ -165,7 +195,7 @@ TODO: `cargo`, `std` features
* `App::gen_completions` in favor of TODO:
* `App::gen_completions_to` in favor of TODO:
* **Arg**
* `Arg::empty_values`
* `Arg::empty_values` in favor of TODO:
* **ArgMatches**
* `ArgMatches::usage` in favor of `App::generate_usage`
* **Macros**
@ -211,7 +241,7 @@ TODO: `cargo`, `std` features
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-rc.0)
* Allowing empty values is no longer the default (changed again in 3.0.0-beta.3)
* `UseValueDelimiter` is no longer the default
* `App::override_usage` no longer implies `\t` which allows multi lined usages
@ -230,7 +260,7 @@ TODO: `cargo`, `std` features
* `Arg::multiple_values`
* `Arg::multiple_occurrences`
* `Arg::help_heading`
* `Arg::settings` (changed again in 3.0.0-rc.0)
* `Arg::settings` (changed again in 3.0.0-beta.3)
* **Added Settings**
* `AppSettings::HelpRequired`
* `AppSettings::NoAutoHelp`

View file

@ -25,11 +25,8 @@ use std::{env, ffi::OsString};
#[cfg(feature = "regex")]
use ::regex::Regex;
#[cfg(feature = "regex")]
mod regex;
#[cfg(feature = "regex")]
pub use self::regex::RegexRef;
#[cfg(feature = "yaml")]
use yaml_rust::Yaml;
// Internal
use crate::{
@ -39,8 +36,11 @@ use crate::{
INTERNAL_ERROR_MSG,
};
#[cfg(feature = "yaml")]
use yaml_rust::Yaml;
#[cfg(feature = "regex")]
mod regex;
#[cfg(feature = "regex")]
pub use self::regex::RegexRef;
type Validator<'a> = dyn FnMut(&str) -> Result<(), Box<dyn Error + Send + Sync>> + Send + 'a;
type ValidatorOs<'a> = dyn FnMut(&OsStr) -> Result<(), Box<dyn Error + Send + Sync>> + Send + 'a;
@ -1753,7 +1753,7 @@ impl<'help> Arg<'help> {
/// not define position in the argument list as a whole.
///
/// **NOTE:** This is only meant to be used for positional arguments and shouldn't to be used
/// with [`Arg::short`] or [`Arg::long`]. If they are defined, they will be ignored.
/// with [`Arg::short`] or [`Arg::long`].
///
/// **NOTE:** You can optionally leave off the `index` method, and the index will be
/// assigned in order of evaluation. Utilizing the `index` method allows for setting

View file

@ -127,10 +127,7 @@ impl MatchedArg {
pub(crate) fn contains_val(&self, val: &str) -> bool {
self.vals_flatten().any(|v| {
if self.case_insensitive {
// For rust v1.53.0 and above, can use
// OsString.eq_ignore_ascii_case
// (https://github.com/rust-lang/rust/pull/80193)
v.to_string_lossy().to_lowercase() == val.to_lowercase()
v.eq_ignore_ascii_case(val)
} else {
OsString::as_os_str(v) == OsStr::new(val)
}