From 8fc12586bb415965f81c315b2565c5851c7f6383 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 29 Nov 2021 10:28:31 -0600 Subject: [PATCH 1/4] fix: Make `AppSettings::HidePossibleValues` mirror `ArgSettings` Fixes #31 --- src/build/app/settings.rs | 12 ++++++++++-- src/build/arg/mod.rs | 2 +- src/output/help.rs | 2 +- tests/app_settings.rs | 2 +- tests/help.rs | 2 +- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/build/app/settings.rs b/src/build/app/settings.rs index b592d858..61e3105b 100644 --- a/src/build/app/settings.rs +++ b/src/build/app/settings.rs @@ -113,6 +113,8 @@ impl_settings! { AppSettings, AppFlags, => Flags::PROPAGATE_VERSION, GlobalVersion("propagateversion") => Flags::PROPAGATE_VERSION, + HidePossibleValues("hidepossiblevalues") + => Flags::NO_POS_VALUES, HidePossibleValuesInHelp("hidepossiblevaluesinhelp") => Flags::NO_POS_VALUES, HelpExpected("helpexpected") @@ -786,6 +788,12 @@ pub enum AppSettings { /// /// To set this per argument, see /// [`Arg::hide_possible_values`][crate::Arg::hide_possible_values]. + HidePossibleValues, + /// Deprecated, replaced with [`AppSettings::HidePossibleValues`] + #[deprecated( + since = "3.0.0", + note = "Replaced with AppSettings::HidePossibleValues" + )] HidePossibleValuesInHelp, /// Panic if help descriptions are omitted. @@ -1195,8 +1203,8 @@ mod test { AppSettings::Hidden ); assert_eq!( - "hidepossiblevaluesinhelp".parse::().unwrap(), - AppSettings::HidePossibleValuesInHelp + "hidepossiblevalues".parse::().unwrap(), + AppSettings::HidePossibleValues ); assert_eq!( "helpexpected".parse::().unwrap(), diff --git a/src/build/arg/mod.rs b/src/build/arg/mod.rs index 1cf13bf2..824f0ce7 100644 --- a/src/build/arg/mod.rs +++ b/src/build/arg/mod.rs @@ -3889,7 +3889,7 @@ impl<'help> Arg<'help> { /// **NOTE:** Setting this requires [`Arg::takes_value`] /// /// To set this for all arguments, see - /// [`AppSettings::HidePossibleValuesInHelp`][crate::AppSettings::HidePossibleValuesInHelp]. + /// [`AppSettings::HidePossibleValues`][crate::AppSettings::HidePossibleValues]. /// /// # Examples /// diff --git a/src/output/help.rs b/src/output/help.rs index a615d049..bb15c051 100644 --- a/src/output/help.rs +++ b/src/output/help.rs @@ -82,7 +82,7 @@ impl<'help, 'app, 'parser, 'writer> Help<'help, 'app, 'parser, 'writer> { ), }; let next_line_help = parser.is_set(AppSettings::NextLineHelp); - let hide_pv = parser.is_set(AppSettings::HidePossibleValuesInHelp); + let hide_pv = parser.is_set(AppSettings::HidePossibleValues); Help { writer, diff --git a/tests/app_settings.rs b/tests/app_settings.rs index 39285488..db65025d 100644 --- a/tests/app_settings.rs +++ b/tests/app_settings.rs @@ -428,7 +428,7 @@ fn skip_possible_values() { .author("Kevin K.") .about("tests stuff") .version("1.3") - .setting(AppSettings::HidePossibleValuesInHelp) + .setting(AppSettings::HidePossibleValues) .args(&[ arg!(-o --opt "some option") .required(false) diff --git a/tests/help.rs b/tests/help.rs index 26708405..5b1bc02e 100644 --- a/tests/help.rs +++ b/tests/help.rs @@ -1168,7 +1168,7 @@ fn issue_688_hidden_pos_vals() { let app1 = App::new("ctest") .version("0.1") .term_width(120) - .setting(AppSettings::HidePossibleValuesInHelp) + .setting(AppSettings::HidePossibleValues) .arg(Arg::new("filter") .help("Sets the filter, or sampling method, to use for interpolation when resizing the particle \ images. The default is Linear (Bilinear). [possible values: Nearest, Linear, Cubic, Gaussian, Lanczos3]") From 57e5fc2b070667091804e984c2cb32a8d0bc0770 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 29 Nov 2021 10:34:42 -0600 Subject: [PATCH 2/4] fix: Rename to `Arg::ignore_case` like `ArgSettings` Fixes #32 --- clap_derive/src/attrs.rs | 4 ++-- clap_derive/src/derives/args.rs | 2 +- clap_derive/src/dummies.rs | 2 +- clap_derive/tests/arg_enum.rs | 12 ++++++------ clap_derive/tests/ui/raw.rs | 2 +- clap_derive/tests/ui/raw.stderr | 4 ++-- src/build/arg/mod.rs | 17 ++++++++++++----- src/derive.rs | 4 ++-- tests/fixtures/app.yaml | 6 +++--- tests/possible_values.rs | 16 ++++++++-------- tests/require.rs | 8 ++++---- tests/unicode.rs | 4 ++-- 12 files changed, 44 insertions(+), 37 deletions(-) diff --git a/clap_derive/src/attrs.rs b/clap_derive/src/attrs.rs index 8590ca3e..c7fdb193 100644 --- a/clap_derive/src/attrs.rs +++ b/clap_derive/src/attrs.rs @@ -837,8 +837,8 @@ impl Attrs { self.is_enum } - pub fn case_insensitive(&self) -> TokenStream { - let method = self.find_method("case_insensitive"); + pub fn ignore_case(&self) -> TokenStream { + let method = self.find_method("ignore_case"); if let Some(method) = method { method.args.clone() diff --git a/clap_derive/src/derives/args.rs b/clap_derive/src/derives/args.rs index e8d10fb1..da4be6b8 100644 --- a/clap_derive/src/derives/args.rs +++ b/clap_derive/src/derives/args.rs @@ -558,7 +558,7 @@ fn gen_parsers( FromFlag => (quote!(), quote!(), func.clone()), }; if attrs.is_enum() { - let ci = attrs.case_insensitive(); + let ci = attrs.ignore_case(); parse = quote_spanned! { convert_type.span()=> |s| <#convert_type as clap::ArgEnum>::from_str(s, #ci).map_err(|err| clap::Error::raw(clap::ErrorKind::ValueValidation, format!("Invalid value for {}: {}", #name, err))) diff --git a/clap_derive/src/dummies.rs b/clap_derive/src/dummies.rs index 2314a05c..49672dd2 100644 --- a/clap_derive/src/dummies.rs +++ b/clap_derive/src/dummies.rs @@ -79,7 +79,7 @@ pub fn arg_enum(name: &Ident) { fn value_variants<'a>() -> &'a [Self]{ unimplemented!() } - fn from_str(_input: &str, _case_insensitive: bool) -> Result { + fn from_str(_input: &str, _ignore_case: bool) -> Result { unimplemented!() } fn to_possible_value<'a>(&self) -> Option>{ diff --git a/clap_derive/tests/arg_enum.rs b/clap_derive/tests/arg_enum.rs index 1de986bd..f5f0bfec 100644 --- a/clap_derive/tests/arg_enum.rs +++ b/clap_derive/tests/arg_enum.rs @@ -186,7 +186,7 @@ fn casing_propagation_is_overridden() { } #[test] -fn case_insensitive() { +fn ignore_case() { #[derive(ArgEnum, PartialEq, Debug, Clone)] enum ArgChoice { Foo, @@ -194,7 +194,7 @@ fn case_insensitive() { #[derive(Parser, PartialEq, Debug)] struct Opt { - #[clap(arg_enum, case_insensitive(true))] + #[clap(arg_enum, ignore_case(true))] arg: ArgChoice, } @@ -213,7 +213,7 @@ fn case_insensitive() { } #[test] -fn case_insensitive_set_to_false() { +fn ignore_case_set_to_false() { #[derive(ArgEnum, PartialEq, Debug, Clone)] enum ArgChoice { Foo, @@ -221,7 +221,7 @@ fn case_insensitive_set_to_false() { #[derive(Parser, PartialEq, Debug)] struct Opt { - #[clap(arg_enum, case_insensitive(false))] + #[clap(arg_enum, ignore_case(false))] arg: ArgChoice, } @@ -244,7 +244,7 @@ fn alias() { #[derive(Parser, PartialEq, Debug)] struct Opt { - #[clap(arg_enum, case_insensitive(false))] + #[clap(arg_enum, ignore_case(false))] arg: ArgChoice, } @@ -272,7 +272,7 @@ fn multiple_alias() { #[derive(Parser, PartialEq, Debug)] struct Opt { - #[clap(arg_enum, case_insensitive(false))] + #[clap(arg_enum, ignore_case(false))] arg: ArgChoice, } diff --git a/clap_derive/tests/ui/raw.rs b/clap_derive/tests/ui/raw.rs index 33af2324..35048233 100644 --- a/clap_derive/tests/ui/raw.rs +++ b/clap_derive/tests/ui/raw.rs @@ -10,7 +10,7 @@ use clap::Parser; #[derive(Parser, Debug)] struct Opt { - #[clap(raw(case_insensitive = "true"))] + #[clap(raw(ignore_case = "true"))] s: String, } diff --git a/clap_derive/tests/ui/raw.stderr b/clap_derive/tests/ui/raw.stderr index 122bef22..ef79e8e5 100644 --- a/clap_derive/tests/ui/raw.stderr +++ b/clap_derive/tests/ui/raw.stderr @@ -1,11 +1,11 @@ error: `#[clap(raw(...))` attributes are removed, they are replaced with raw methods = help: if you meant to call `clap::Arg::raw()` method you should use bool literal, like `raw(true)` or `raw(false)` - = note: if you need to call `clap::Arg/App::case_insensitive` method you can do it like this: #[clap(case_insensitive = true)] + = note: if you need to call `clap::Arg/App::ignore_case` method you can do it like this: #[clap(ignore_case = true)] --> $DIR/raw.rs:13:12 | -13 | #[clap(raw(case_insensitive = "true"))] +13 | #[clap(raw(ignore_case = "true"))] | ^^^ error: `#[clap(raw(...))` attributes are removed, they are replaced with raw methods diff --git a/src/build/arg/mod.rs b/src/build/arg/mod.rs index 824f0ce7..872ca7ec 100644 --- a/src/build/arg/mod.rs +++ b/src/build/arg/mod.rs @@ -434,7 +434,7 @@ impl<'help> Arg<'help> { "overrides_with_all" => yaml_vec_or_str!(a, v, overrides_with), "possible_value" => yaml_to_str!(a, v, possible_value), "possible_values" => yaml_vec_or_str!(a, v, possible_value), - "case_insensitive" => yaml_to_bool!(a, v, case_insensitive), + "ignore_case" => yaml_to_bool!(a, v, ignore_case), "required_unless_present_any" => yaml_vec!(a, v, required_unless_present_any), "required_unless_present_all" => yaml_vec!(a, v, required_unless_present_all), "visible_alias" => yaml_to_str!(a, v, visible_alias), @@ -1642,7 +1642,7 @@ impl<'help> Arg<'help> { /// .long("config")) /// .arg(Arg::new("other") /// .long("other") - /// .case_insensitive(true) + /// .ignore_case(true) /// .takes_value(true)) /// .try_get_matches_from(vec![ /// "prog", "--other", "SPECIAL" @@ -4004,7 +4004,7 @@ impl<'help> Arg<'help> { /// .arg(Arg::new("option") /// .long("--option") /// .takes_value(true) - /// .case_insensitive(true) + /// .ignore_case(true) /// .possible_value("test123")) /// .get_matches_from(vec![ /// "pv", "--option", "TeSt123", @@ -4022,7 +4022,7 @@ impl<'help> Arg<'help> { /// .short('o') /// .long("--option") /// .takes_value(true) - /// .case_insensitive(true) + /// .ignore_case(true) /// .multiple_values(true) /// .possible_values(&["test123", "test321"])) /// .get_matches_from(vec![ @@ -4033,7 +4033,7 @@ impl<'help> Arg<'help> { /// assert_eq!(&*matched_vals, &["TeSt123", "teST123", "tESt321"]); /// ``` #[inline] - pub fn case_insensitive(self, ci: bool) -> Self { + pub fn ignore_case(self, ci: bool) -> Self { if ci { self.setting(ArgSettings::IgnoreCase) } else { @@ -4041,6 +4041,13 @@ impl<'help> Arg<'help> { } } + /// Deprecated, replaced with [`Arg::ignore_case`] + #[deprecated(since = "3.0.0", note = "Replaced with `Arg::ignore_case`")] + #[inline] + pub fn case_insensitive(self, ci: bool) -> Self { + self.ignore_case(ci) + } + /// Specifies that an argument should allow grouping of multiple values via a /// delimiter. /// diff --git a/src/derive.rs b/src/derive.rs index 170133f9..90360835 100644 --- a/src/derive.rs +++ b/src/derive.rs @@ -313,13 +313,13 @@ pub trait ArgEnum: Sized + Clone { fn value_variants<'a>() -> &'a [Self]; /// Parse an argument into `Self`. - fn from_str(input: &str, case_insensitive: bool) -> Result { + fn from_str(input: &str, ignore_case: bool) -> Result { Self::value_variants() .iter() .find(|v| { v.to_possible_value() .expect("ArgEnum::value_variants contains only values with a corresponding ArgEnum::to_possible_value") - .matches(input, case_insensitive) + .matches(input, ignore_case) }) .cloned() .ok_or_else(|| format!("Invalid variant: {}", input)) diff --git a/tests/fixtures/app.yaml b/tests/fixtures/app.yaml index 77f0da67..35ad9fc8 100644 --- a/tests/fixtures/app.yaml +++ b/tests/fixtures/app.yaml @@ -115,11 +115,11 @@ args: long: exclusive help: Tests 3 exclusive exclusive: true - - case_insensitive: + - ignore_case: index: 4 - help: Test case_insensitive + help: Test ignore case possible_values: [test123, test321] - case_insensitive: true + ignore_case: true - value_hint: long: value-hint help: Test value_hint diff --git a/tests/possible_values.rs b/tests/possible_values.rs index dcaf8ecd..e933a530 100644 --- a/tests/possible_values.rs +++ b/tests/possible_values.rs @@ -275,7 +275,7 @@ fn alias() { .takes_value(true) .possible_value(PossibleValue::new("test123").alias("123")) .possible_value("test321") - .case_insensitive(true), + .ignore_case(true), ) .try_get_matches_from(vec!["pv", "--option", "123"]); @@ -293,7 +293,7 @@ fn aliases() { .takes_value(true) .possible_value(PossibleValue::new("test123").aliases(["1", "2", "3"])) .possible_value("test321") - .case_insensitive(true), + .ignore_case(true), ) .try_get_matches_from(vec!["pv", "--option", "2"]); @@ -302,7 +302,7 @@ fn aliases() { } #[test] -fn case_insensitive() { +fn ignore_case() { let m = App::new("pv") .arg( Arg::new("option") @@ -311,7 +311,7 @@ fn case_insensitive() { .takes_value(true) .possible_value("test123") .possible_value("test321") - .case_insensitive(true), + .ignore_case(true), ) .try_get_matches_from(vec!["pv", "--option", "TeSt123"]); @@ -324,7 +324,7 @@ fn case_insensitive() { } #[test] -fn case_insensitive_fail() { +fn ignore_case_fail() { let m = App::new("pv") .arg( Arg::new("option") @@ -341,7 +341,7 @@ fn case_insensitive_fail() { } #[test] -fn case_insensitive_multiple() { +fn ignore_case_multiple() { let m = App::new("pv") .arg( Arg::new("option") @@ -351,7 +351,7 @@ fn case_insensitive_multiple() { .possible_value("test123") .possible_value("test321") .multiple_values(true) - .case_insensitive(true), + .ignore_case(true), ) .try_get_matches_from(vec!["pv", "--option", "TeSt123", "teST123", "tESt321"]); @@ -363,7 +363,7 @@ fn case_insensitive_multiple() { } #[test] -fn case_insensitive_multiple_fail() { +fn ignore_case_multiple_fail() { let m = App::new("pv") .arg( Arg::new("option") diff --git a/tests/require.rs b/tests/require.rs index eb23f169..81d1ab59 100644 --- a/tests/require.rs +++ b/tests/require.rs @@ -543,7 +543,7 @@ fn required_if_val_present_fail() { } #[test] -fn required_if_val_present_case_insensitive_pass() { +fn required_if_val_present_ignore_case_pass() { let res = App::new("ri") .arg( Arg::new("cfg") @@ -555,7 +555,7 @@ fn required_if_val_present_case_insensitive_pass() { Arg::new("extra") .takes_value(true) .long("extra") - .case_insensitive(true), + .ignore_case(true), ) .try_get_matches_from(vec!["ri", "--extra", "vaL", "--config", "my.cfg"]); @@ -563,7 +563,7 @@ fn required_if_val_present_case_insensitive_pass() { } #[test] -fn required_if_val_present_case_insensitive_fail() { +fn required_if_val_present_ignore_case_fail() { let res = App::new("ri") .arg( Arg::new("cfg") @@ -575,7 +575,7 @@ fn required_if_val_present_case_insensitive_fail() { Arg::new("extra") .takes_value(true) .long("extra") - .case_insensitive(true), + .ignore_case(true), ) .try_get_matches_from(vec!["ri", "--extra", "vaL"]); diff --git a/tests/unicode.rs b/tests/unicode.rs index 408c1186..af86908d 100644 --- a/tests/unicode.rs +++ b/tests/unicode.rs @@ -1,7 +1,7 @@ #![cfg(feature = "unicode")] #[test] -fn possible_values_case_insensitive() { +fn possible_values_ignore_case() { let m = clap::App::new("pv") .arg( clap::Arg::new("option") @@ -9,7 +9,7 @@ fn possible_values_case_insensitive() { .long("--option") .takes_value(true) .possible_value("ä") - .case_insensitive(true), + .ignore_case(true), ) .try_get_matches_from(vec!["pv", "--option", "Ä"]); From 62d7a3a928b1e4310fece851e0a2daf461f56a09 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 29 Nov 2021 10:45:30 -0600 Subject: [PATCH 3/4] fix: Be consistent on hide/hidden - `PossibleValue::hidden` -> `PossibleValue::hide` (new in clap3, no breakin change) Fixes #33 --- benches/06_rustup.rs | 2 +- clap_derive/examples/arg_enum.rs | 2 +- src/build/arg/mod.rs | 53 ++++++++++++++++++++------------ src/build/arg/possible_value.rs | 18 +++++------ tests/help.rs | 24 +++++++-------- tests/hidden_args.rs | 52 +++++++++++++++---------------- tests/possible_values.rs | 4 +-- 7 files changed, 85 insertions(+), 70 deletions(-) diff --git a/benches/06_rustup.rs b/benches/06_rustup.rs index 5b36c5f7..0f23f16d 100644 --- a/benches/06_rustup.rs +++ b/benches/06_rustup.rs @@ -55,7 +55,7 @@ fn build_cli() -> App<'static> { Arg::new("no-self-update") .help("Don't perform self update when running the `rustup` command") .long("no-self-update") - .hidden(true), + .hide(true), ), ) .subcommand( diff --git a/clap_derive/examples/arg_enum.rs b/clap_derive/examples/arg_enum.rs index 89616e66..6e30dcce 100644 --- a/clap_derive/examples/arg_enum.rs +++ b/clap_derive/examples/arg_enum.rs @@ -15,7 +15,7 @@ enum ArgChoice { #[clap(alias = "b", alias = "z")] Baz, // Hiding variants from help and completion is supported - #[clap(hidden = true)] + #[clap(hide = true)] Hidden, } diff --git a/src/build/arg/mod.rs b/src/build/arg/mod.rs index 872ca7ec..74729a42 100644 --- a/src/build/arg/mod.rs +++ b/src/build/arg/mod.rs @@ -390,9 +390,9 @@ impl<'help> Arg<'help> { "global" => yaml_to_bool!(a, v, global), "multiple_occurrences" => yaml_to_bool!(a, v, multiple_occurrences), "multiple_values" => yaml_to_bool!(a, v, multiple_values), - "hidden" => yaml_to_bool!(a, v, hidden), - "hidden_long_help" => yaml_to_bool!(a, v, hidden_long_help), - "hidden_short_help" => yaml_to_bool!(a, v, hidden_short_help), + "hide" => yaml_to_bool!(a, v, hide), + "hide_long_help" => yaml_to_bool!(a, v, hide_long_help), + "hide_short_help" => yaml_to_bool!(a, v, hide_short_help), "next_line_help" => yaml_to_bool!(a, v, next_line_help), "group" => yaml_to_str!(a, v, group), "number_of_values" => yaml_to_usize!(a, v, number_of_values), @@ -3976,7 +3976,7 @@ impl<'help> Arg<'help> { /// -V, --version Print version information /// ``` #[inline] - pub fn hidden(self, h: bool) -> Self { + pub fn hide(self, h: bool) -> Self { if h { self.setting(ArgSettings::Hidden) } else { @@ -3984,6 +3984,13 @@ impl<'help> Arg<'help> { } } + /// Deprecated, replaced with [`Arg::hide`] + #[deprecated(since = "3.0.0", note = "Replaced with `Arg::hide`")] + #[inline] + pub fn hidden(self, h: bool) -> Self { + self.hide(h) + } + /// Match values against [`Arg::possible_values`] without matching case. /// /// When other arguments are conditionally required based on the @@ -4560,17 +4567,17 @@ impl<'help> Arg<'help> { /// ```rust /// # use clap::{App, Arg}; /// Arg::new("debug") - /// .hidden_short_help(true); + /// .hide_short_help(true); /// ``` /// - /// Setting `hidden_short_help(true)` will hide the argument when displaying short help text + /// Setting `hide_short_help(true)` will hide the argument when displaying short help text /// /// ```rust /// # use clap::{App, Arg}; /// let m = App::new("prog") /// .arg(Arg::new("cfg") /// .long("config") - /// .hidden_short_help(true) + /// .hide_short_help(true) /// .help("Some help text describing the --config arg")) /// .get_matches_from(vec![ /// "prog", "-h" @@ -4597,7 +4604,7 @@ impl<'help> Arg<'help> { /// let m = App::new("prog") /// .arg(Arg::new("cfg") /// .long("config") - /// .hidden_short_help(true) + /// .hide_short_help(true) /// .help("Some help text describing the --config arg")) /// .get_matches_from(vec![ /// "prog", "--help" @@ -4618,7 +4625,7 @@ impl<'help> Arg<'help> { /// -V, --version Print version information /// ``` #[inline] - pub fn hidden_short_help(self, hide: bool) -> Self { + pub fn hide_short_help(self, hide: bool) -> Self { if hide { self.setting(ArgSettings::HiddenShortHelp) } else { @@ -4626,6 +4633,13 @@ impl<'help> Arg<'help> { } } + /// Deprecated, replaced with [`Arg::hide_short_help`] + #[deprecated(since = "3.0.0", note = "Replaced with `Arg::hide_short_help`")] + #[inline] + pub fn hidden_short_help(self, h: bool) -> Self { + self.hide_short_help(h) + } + /// Hides an argument from long help (`--help`). /// /// **NOTE:** This does **not** hide the argument from usage strings on error @@ -4635,20 +4649,14 @@ impl<'help> Arg<'help> { /// /// # Examples /// - /// ```rust - /// # use clap::{App, Arg}; - /// Arg::new("debug") - /// .hidden_long_help(true) - /// # ; - /// ``` - /// Setting `hidden_long_help(true)` will hide the argument when displaying long help text + /// Setting `hide_long_help(true)` will hide the argument when displaying long help text /// /// ```rust /// # use clap::{App, Arg}; /// let m = App::new("prog") /// .arg(Arg::new("cfg") /// .long("config") - /// .hidden_long_help(true) + /// .hide_long_help(true) /// .help("Some help text describing the --config arg")) /// .get_matches_from(vec![ /// "prog", "--help" @@ -4675,7 +4683,7 @@ impl<'help> Arg<'help> { /// let m = App::new("prog") /// .arg(Arg::new("cfg") /// .long("config") - /// .hidden_long_help(true) + /// .hide_long_help(true) /// .help("Some help text describing the --config arg")) /// .get_matches_from(vec![ /// "prog", "-h" @@ -4696,7 +4704,7 @@ impl<'help> Arg<'help> { /// -V, --version Print version information /// ``` #[inline] - pub fn hidden_long_help(self, hide: bool) -> Self { + pub fn hide_long_help(self, hide: bool) -> Self { if hide { self.setting(ArgSettings::HiddenLongHelp) } else { @@ -4704,6 +4712,13 @@ impl<'help> Arg<'help> { } } + /// Deprecated, replaced with [`Arg::hide_long_help`] + #[deprecated(since = "3.0.0", note = "Replaced with `Arg::hide_long_help`")] + #[inline] + pub fn hidden_long_help(self, h: bool) -> Self { + self.hide_long_help(h) + } + /// Check if the [`ArgSettings`] variant is currently set on the argument. /// /// [`ArgSettings`]: crate::ArgSettings diff --git a/src/build/arg/possible_value.rs b/src/build/arg/possible_value.rs index 3692bf55..13017812 100644 --- a/src/build/arg/possible_value.rs +++ b/src/build/arg/possible_value.rs @@ -18,18 +18,18 @@ use crate::util::eq_ignore_case; /// .value_name("FILE") /// .possible_value(PossibleValue::new("fast")) /// .possible_value(PossibleValue::new("slow").help("slower than fast")) -/// .possible_value(PossibleValue::new("secret speed").hidden(true)); +/// .possible_value(PossibleValue::new("secret speed").hide(true)); /// ``` /// [Args]: crate::Arg /// [possible values]: crate::Arg::possible_value() -/// [hide]: PossibleValue::hidden() +/// [hide]: PossibleValue::hide() /// [help]: PossibleValue::help() #[derive(Debug, Default, Clone, PartialEq, Eq)] pub struct PossibleValue<'help> { pub(crate) name: &'help str, pub(crate) help: Option<&'help str>, pub(crate) aliases: Vec<&'help str>, // (name, visible) - pub(crate) hidden: bool, + pub(crate) hide: bool, } impl<'help> From<&'help str> for PossibleValue<'help> { @@ -61,12 +61,12 @@ impl<'help> PossibleValue<'help> { /// Should the value be hidden from help messages and completion #[inline] pub fn is_hidden(&self) -> bool { - self.hidden + self.hide } /// Get the name if argument value is not hidden, `None` otherwise pub fn get_visible_name(&self) -> Option<&str> { - if self.hidden { + if self.hide { None } else { Some(self.name) @@ -121,7 +121,7 @@ impl<'help> PossibleValue<'help> { /// PossibleValue::new("fast") /// # ; /// ``` - /// [hidden]: PossibleValue::hidden + /// [hidden]: PossibleValue::hide /// [possible value]: crate::Arg::possible_values /// [`Arg::hide_possible_values(true)`]: crate::Arg::hide_possible_values() pub fn new(name: &'help str) -> Self { @@ -160,13 +160,13 @@ impl<'help> PossibleValue<'help> { /// ```rust /// # use clap::PossibleValue; /// PossibleValue::new("secret") - /// .hidden(true) + /// .hide(true) /// # ; /// ``` /// [`Arg::hide_possible_values(true)`]: crate::Arg::hide_possible_values() #[inline] - pub fn hidden(mut self, yes: bool) -> Self { - self.hidden = yes; + pub fn hide(mut self, yes: bool) -> Self { + self.hide = yes; self } diff --git a/tests/help.rs b/tests/help.rs index 5b1bc02e..d41471f0 100644 --- a/tests/help.rs +++ b/tests/help.rs @@ -1058,7 +1058,7 @@ fn hide_single_possible_val() { .long("pos") .value_name("VAL") .possible_values(["fast", "slow"]) - .possible_value(PossibleValue::new("secret speed").hidden(true)) + .possible_value(PossibleValue::new("secret speed").hide(true)) .help("Some vals") .takes_value(true), ) @@ -1162,7 +1162,7 @@ fn old_newline_chars() { } #[test] -fn issue_688_hidden_pos_vals() { +fn issue_688_hide_pos_vals() { let filter_values = ["Nearest", "Linear", "Cubic", "Gaussian", "Lanczos3"]; let app1 = App::new("ctest") @@ -1382,12 +1382,12 @@ fn sc_negates_reqs() { } #[test] -fn hidden_args() { +fn hide_args() { let app = App::new("prog") .version("1.0") .arg(arg!(-f --flag "testing flags")) .arg(arg!(-o --opt "tests options").required(false)) - .arg(Arg::new("pos").hidden(true)); + .arg(Arg::new("pos").hide(true)); assert!(utils::compare_output( app, "prog --help", @@ -1414,7 +1414,7 @@ fn args_negate_sc() { } #[test] -fn issue_1046_hidden_scs() { +fn issue_1046_hide_scs() { let app = App::new("prog") .version("1.0") .arg(arg!(-f --flag "testing flags")) @@ -1637,7 +1637,7 @@ fn last_arg_mult_usage_with_sc() { } #[test] -fn hidden_default_val() { +fn hide_default_val() { let app1 = App::new("default").version("0.1").term_width(120).arg( Arg::new("argument") .help("Pass an argument to the program. [default: default-argument]") @@ -1897,7 +1897,7 @@ SPECIAL: "; #[test] -fn custom_help_headers_hidden_args() { +fn custom_help_headers_hide_args() { let app = App::new("blorp") .author("Will M.") .about("does stuff") @@ -1908,7 +1908,7 @@ fn custom_help_headers_hidden_args() { .short('n') .long("no-proxy") .help("Do not use system proxy settings") - .hidden_short_help(true), + .hide_short_help(true), ) .help_heading(Some("SPECIAL")) .arg( @@ -1925,7 +1925,7 @@ fn custom_help_headers_hidden_args() { .long("server-addr") .help("Set server address") .help_heading(Some("NETWORKING")) - .hidden_short_help(true), + .hide_short_help(true), ); assert!(utils::compare_output( @@ -2003,7 +2003,7 @@ fn issue_1364_no_short_options() { Arg::new("baz") .short('z') .value_name("BAZ") - .hidden_short_help(true), + .hide_short_help(true), ) .arg( Arg::new("files") @@ -2403,7 +2403,7 @@ fn only_custom_heading_opts_no_args() { let app = App::new("test") .version("1.4") .setting(AppSettings::DisableVersionFlag) - .mut_arg("help", |a| a.hidden(true)) + .mut_arg("help", |a| a.hide(true)) .help_heading(Some("NETWORKING")) .arg(arg!(-s --speed "How fast").required(false)); @@ -2429,7 +2429,7 @@ fn only_custom_heading_pos_no_args() { let app = App::new("test") .version("1.4") .setting(AppSettings::DisableVersionFlag) - .mut_arg("help", |a| a.hidden(true)) + .mut_arg("help", |a| a.hide(true)) .help_heading(Some("NETWORKING")) .arg(Arg::new("speed").help("How fast")); diff --git a/tests/hidden_args.rs b/tests/hidden_args.rs index 1b4f656d..60b833df 100644 --- a/tests/hidden_args.rs +++ b/tests/hidden_args.rs @@ -19,16 +19,16 @@ OPTIONS: "; #[test] -fn hidden_args() { +fn hide_args() { let app = App::new("test") .author("Kevin K.") .about("tests stuff") .version("1.4") .args(&[ - arg!(-f --flag "some flag").hidden(true), + arg!(-f --flag "some flag").hide(true), arg!(-F --flag2 "some other flag"), arg!(--option "some option").required(false), - Arg::new("DUMMY").hidden(true), + Arg::new("DUMMY").hide(true), ]); assert!(utils::compare_output( app, @@ -76,9 +76,9 @@ OPTIONS: Print version information "; -/// Ensure hidden with short option +/// Ensure hide with short option #[test] -fn hidden_short_args() { +fn hide_short_args() { let app = App::new("test") .about("hides short args") .author("Steve P.") @@ -87,7 +87,7 @@ fn hidden_short_args() { Arg::new("cfg") .short('c') .long("config") - .hidden_short_help(true) + .hide_short_help(true) .help("Some help text describing the --config arg"), Arg::new("visible") .short('v') @@ -105,7 +105,7 @@ fn hidden_short_args() { /// Ensure visible with opposite option #[test] -fn hidden_short_args_long_help() { +fn hide_short_args_long_help() { let app = App::new("test") .about("hides short args") .author("Steve P.") @@ -114,7 +114,7 @@ fn hidden_short_args_long_help() { Arg::new("cfg") .short('c') .long("config") - .hidden_short_help(true) + .hide_short_help(true) .help("Some help text describing the --config arg"), Arg::new("visible") .short('v') @@ -151,7 +151,7 @@ OPTIONS: "; #[test] -fn hidden_long_args() { +fn hide_long_args() { let app = App::new("test") .about("hides long args") .author("Steve P.") @@ -160,7 +160,7 @@ fn hidden_long_args() { Arg::new("cfg") .short('c') .long("config") - .hidden_long_help(true) + .hide_long_help(true) .help("Some help text describing the --config arg"), Arg::new("visible") .short('v') @@ -193,7 +193,7 @@ OPTIONS: "; #[test] -fn hidden_long_args_short_help() { +fn hide_long_args_short_help() { let app = App::new("test") .about("hides long args") .author("Steve P.") @@ -202,7 +202,7 @@ fn hidden_long_args_short_help() { Arg::new("cfg") .short('c') .long("config") - .hidden_long_help(true) + .hide_long_help(true) .help("Some help text describing the --config arg"), Arg::new("visible") .short('v') @@ -232,9 +232,9 @@ OPTIONS: "; #[test] -fn hidden_pos_args() { +fn hide_pos_args() { let app = App::new("test").version("1.4").args(&[ - Arg::new("pos").help("some pos").hidden(true), + Arg::new("pos").help("some pos").hide(true), Arg::new("another").help("another pos"), ]); @@ -257,7 +257,7 @@ OPTIONS: "; #[test] -fn hidden_subcmds() { +fn hide_subcmds() { let app = App::new("test") .version("1.4") .subcommand(App::new("sub").setting(AppSettings::Hidden)); @@ -279,16 +279,16 @@ After help "; #[test] -fn hidden_opt_args_only() { +fn hide_opt_args_only() { let app = App::new("test") .version("1.4") .after_help("After help") - .mut_arg("help", |a| a.hidden(true)) - .mut_arg("version", |a| a.hidden(true)) + .mut_arg("help", |a| a.hide(true)) + .mut_arg("version", |a| a.hide(true)) .arg( arg!(--option "some option") .required(false) - .hidden(true), + .hide(true), ); assert!(utils::compare_output( @@ -308,13 +308,13 @@ After help "; #[test] -fn hidden_pos_args_only() { +fn hide_pos_args_only() { let app = App::new("test") .version("1.4") .after_help("After help") - .mut_arg("help", |a| a.hidden(true)) - .mut_arg("version", |a| a.hidden(true)) - .args(&[Arg::new("pos").help("some pos").hidden(true)]); + .mut_arg("help", |a| a.hide(true)) + .mut_arg("version", |a| a.hide(true)) + .args(&[Arg::new("pos").help("some pos").hide(true)]); assert!(utils::compare_output( app, @@ -333,12 +333,12 @@ After help "; #[test] -fn hidden_subcmds_only() { +fn hide_subcmds_only() { let app = App::new("test") .version("1.4") .after_help("After help") - .mut_arg("help", |a| a.hidden(true)) - .mut_arg("version", |a| a.hidden(true)) + .mut_arg("help", |a| a.hide(true)) + .mut_arg("version", |a| a.hide(true)) .subcommand(App::new("sub").setting(AppSettings::Hidden)); assert!(utils::compare_output( diff --git a/tests/possible_values.rs b/tests/possible_values.rs index e933a530..5f5ee84b 100644 --- a/tests/possible_values.rs +++ b/tests/possible_values.rs @@ -65,7 +65,7 @@ fn possible_value_arg_value() { .arg( Arg::new("arg_value").index(1).possible_value( PossibleValue::new("test123") - .hidden(false) + .hide(false) .help("It's just a test"), ), ) @@ -243,7 +243,7 @@ fn possible_values_hidden_output() { .short('O') .possible_values(["slow", "fast"]) .possible_value(PossibleValue::new("ludicrous speed")) - .possible_value(PossibleValue::new("forbidden speed").hidden(true)) + .possible_value(PossibleValue::new("forbidden speed").hide(true)) ), "clap-test -O slo", PV_ERROR, From 44700506ebd32f3d079fd7e15caa11f4403b5102 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 29 Nov 2021 11:21:45 -0600 Subject: [PATCH 4/4] docs: Be consistent in builder args --- src/build/arg/mod.rs | 122 ++++++++++++++++++++--------------------- src/build/arg_group.rs | 8 +-- 2 files changed, 65 insertions(+), 65 deletions(-) diff --git a/src/build/arg/mod.rs b/src/build/arg/mod.rs index 74729a42..5b435b60 100644 --- a/src/build/arg/mod.rs +++ b/src/build/arg/mod.rs @@ -1252,8 +1252,8 @@ impl<'help> Arg<'help> { /// assert_eq!(res.unwrap_err().kind, ErrorKind::ArgumentConflict); /// ``` #[inline] - pub fn exclusive(mut self, exclusive: bool) -> Self { - self.exclusive = exclusive; + pub fn exclusive(mut self, yes: bool) -> Self { + self.exclusive = yes; self } @@ -2311,8 +2311,8 @@ impl<'help> Arg<'help> { /// [`ArgMatches::value_of_lossy`]: crate::ArgMatches::value_of_lossy() /// [`ArgMatches::values_of_lossy`]: crate::ArgMatches::values_of_lossy() #[inline] - pub fn allow_invalid_utf8(self, tv: bool) -> Self { - if tv { + pub fn allow_invalid_utf8(self, yes: bool) -> Self { + if yes { self.setting(ArgSettings::AllowInvalidUtf8) } else { self.unset_setting(ArgSettings::AllowInvalidUtf8) @@ -3537,8 +3537,8 @@ impl<'help> Arg<'help> { /// [index]: Arg::index() /// [`UnknownArgument`]: crate::ErrorKind::UnknownArgument #[inline] - pub fn last(self, l: bool) -> Self { - if l { + pub fn last(self, yes: bool) -> Self { + if yes { self.setting(ArgSettings::Last) } else { self.unset_setting(ArgSettings::Last) @@ -3599,8 +3599,8 @@ impl<'help> Arg<'help> { /// assert_eq!(res.unwrap_err().kind, ErrorKind::MissingRequiredArgument); /// ``` #[inline] - pub fn required(self, r: bool) -> Self { - if r { + pub fn required(self, yes: bool) -> Self { + if yes { self.setting(ArgSettings::Required) } else { self.unset_setting(ArgSettings::Required) @@ -3639,8 +3639,8 @@ impl<'help> Arg<'help> { /// [`Arg::value_delimiter(char)`]: Arg::value_delimiter() /// [multiple values]: Arg::multiple_values #[inline] - pub fn takes_value(self, tv: bool) -> Self { - if tv { + pub fn takes_value(self, yes: bool) -> Self { + if yes { self.setting(ArgSettings::TakesValue) } else { self.unset_setting(ArgSettings::TakesValue) @@ -3698,8 +3698,8 @@ impl<'help> Arg<'help> { /// ``` /// [`Arg::number_of_values(1)`]: Arg::number_of_values() #[inline] - pub fn allow_hyphen_values(self, a: bool) -> Self { - if a { + pub fn allow_hyphen_values(self, yes: bool) -> Self { + if yes { self.setting(ArgSettings::AllowHyphenValues) } else { self.unset_setting(ArgSettings::AllowHyphenValues) @@ -3749,8 +3749,8 @@ impl<'help> Arg<'help> { /// assert_eq!(res.unwrap_err().kind, ErrorKind::NoEquals); /// ``` #[inline] - pub fn require_equals(self, r: bool) -> Self { - if r { + pub fn require_equals(self, yes: bool) -> Self { + if yes { self.setting(ArgSettings::RequireEquals) } else { self.unset_setting(ArgSettings::RequireEquals) @@ -3791,8 +3791,8 @@ impl<'help> Arg<'help> { /// [`Subcommand`]: crate::Subcommand /// [`ArgMatches::is_present("flag")`]: ArgMatches::is_present() #[inline] - pub fn global(mut self, g: bool) -> Self { - self.global = g; + pub fn global(mut self, yes: bool) -> Self { + self.global = yes; self } @@ -3873,8 +3873,8 @@ impl<'help> Arg<'help> { /// assert_eq!(delims.values_of("opt").unwrap().collect::>(), ["val1", "val2", "val3"]); /// ``` #[inline] - pub fn require_delimiter(self, d: bool) -> Self { - if d { + pub fn require_delimiter(self, yes: bool) -> Self { + if yes { self.setting(ArgSettings::RequireDelimiter) } else { self.unset_setting(ArgSettings::RequireDelimiter) @@ -3905,8 +3905,8 @@ impl<'help> Arg<'help> { /// If we were to run the above program with `--help` the `[values: fast, slow]` portion of /// the help text would be omitted. #[inline] - pub fn hide_possible_values(self, hide: bool) -> Self { - if hide { + pub fn hide_possible_values(self, yes: bool) -> Self { + if yes { self.setting(ArgSettings::HidePossibleValues) } else { self.unset_setting(ArgSettings::HidePossibleValues) @@ -3935,8 +3935,8 @@ impl<'help> Arg<'help> { /// If we were to run the above program with `--help` the `[default: localhost]` portion of /// the help text would be omitted. #[inline] - pub fn hide_default_value(self, hide: bool) -> Self { - if hide { + pub fn hide_default_value(self, yes: bool) -> Self { + if yes { self.setting(ArgSettings::HideDefaultValue) } else { self.unset_setting(ArgSettings::HideDefaultValue) @@ -3976,8 +3976,8 @@ impl<'help> Arg<'help> { /// -V, --version Print version information /// ``` #[inline] - pub fn hide(self, h: bool) -> Self { - if h { + pub fn hide(self, yes: bool) -> Self { + if yes { self.setting(ArgSettings::Hidden) } else { self.unset_setting(ArgSettings::Hidden) @@ -3987,8 +3987,8 @@ impl<'help> Arg<'help> { /// Deprecated, replaced with [`Arg::hide`] #[deprecated(since = "3.0.0", note = "Replaced with `Arg::hide`")] #[inline] - pub fn hidden(self, h: bool) -> Self { - self.hide(h) + pub fn hidden(self, yes: bool) -> Self { + self.hide(yes) } /// Match values against [`Arg::possible_values`] without matching case. @@ -4040,8 +4040,8 @@ impl<'help> Arg<'help> { /// assert_eq!(&*matched_vals, &["TeSt123", "teST123", "tESt321"]); /// ``` #[inline] - pub fn ignore_case(self, ci: bool) -> Self { - if ci { + pub fn ignore_case(self, yes: bool) -> Self { + if yes { self.setting(ArgSettings::IgnoreCase) } else { self.unset_setting(ArgSettings::IgnoreCase) @@ -4051,8 +4051,8 @@ impl<'help> Arg<'help> { /// Deprecated, replaced with [`Arg::ignore_case`] #[deprecated(since = "3.0.0", note = "Replaced with `Arg::ignore_case`")] #[inline] - pub fn case_insensitive(self, ci: bool) -> Self { - self.ignore_case(ci) + pub fn case_insensitive(self, yes: bool) -> Self { + self.ignore_case(yes) } /// Specifies that an argument should allow grouping of multiple values via a @@ -4105,8 +4105,8 @@ impl<'help> Arg<'help> { /// ``` /// [`Arg::value_delimiter`]: Arg::value_delimiter() #[inline] - pub fn use_delimiter(mut self, d: bool) -> Self { - if d { + pub fn use_delimiter(mut self, yes: bool) -> Self { + if yes { if self.val_delim.is_none() { self.val_delim = Some(','); } @@ -4138,8 +4138,8 @@ impl<'help> Arg<'help> { /// text would be omitted. #[cfg(feature = "env")] #[inline] - pub fn hide_env(self, hide: bool) -> Self { - if hide { + pub fn hide_env(self, yes: bool) -> Self { + if yes { self.setting(ArgSettings::HideEnv) } else { self.unset_setting(ArgSettings::HideEnv) @@ -4167,8 +4167,8 @@ impl<'help> Arg<'help> { /// `[default: CONNECT=super_secret]` portion of the help text would be omitted. #[cfg(feature = "env")] #[inline] - pub fn hide_env_values(self, hide: bool) -> Self { - if hide { + pub fn hide_env_values(self, yes: bool) -> Self { + if yes { self.setting(ArgSettings::HideEnvValues) } else { self.unset_setting(ArgSettings::HideEnvValues) @@ -4219,8 +4219,8 @@ impl<'help> Arg<'help> { /// on a line after the option /// ``` #[inline] - pub fn next_line_help(self, nlh: bool) -> Self { - if nlh { + pub fn next_line_help(self, yes: bool) -> Self { + if yes { self.setting(ArgSettings::NextLineHelp) } else { self.unset_setting(ArgSettings::NextLineHelp) @@ -4273,8 +4273,8 @@ impl<'help> Arg<'help> { /// assert_eq!(res.unwrap_err().kind, ErrorKind::EmptyValue); /// ``` #[inline] - pub fn forbid_empty_values(self, empty: bool) -> Self { - if empty { + pub fn forbid_empty_values(self, yes: bool) -> Self { + if yes { self.setting(ArgSettings::ForbidEmptyValues) } else { self.unset_setting(ArgSettings::ForbidEmptyValues) @@ -4283,8 +4283,8 @@ impl<'help> Arg<'help> { /// Deprecated, replaced with [`Arg::forbid_empty_values`] #[deprecated(since = "3.0.0", note = "Replaced with `Arg::forbid_empty_values`")] - pub fn empty_values(self, empty: bool) -> Self { - self.forbid_empty_values(!empty) + pub fn empty_values(self, yes: bool) -> Self { + self.forbid_empty_values(!yes) } /// Specifies that the argument may have an unknown number of values @@ -4453,8 +4453,8 @@ impl<'help> Arg<'help> { /// [maximum]: Arg::max_values() /// [specific]: Arg::number_of_values() #[inline] - pub fn multiple_values(self, multi: bool) -> Self { - if multi { + pub fn multiple_values(self, yes: bool) -> Self { + if yes { self.setting(ArgSettings::MultipleValues) } else { self.unset_setting(ArgSettings::MultipleValues) @@ -4507,8 +4507,8 @@ impl<'help> Arg<'help> { /// assert_eq!(files, ["file1", "file2", "file3"]); /// ``` #[inline] - pub fn multiple_occurrences(self, multi: bool) -> Self { - if multi { + pub fn multiple_occurrences(self, yes: bool) -> Self { + if yes { self.setting(ArgSettings::MultipleOccurrences) } else { self.unset_setting(ArgSettings::MultipleOccurrences) @@ -4521,8 +4521,8 @@ impl<'help> Arg<'help> { since = "3.0.0", note = "Split into `Arg::multiple_occurrences` (most likely what you want) and `Arg::multiple_values`" )] - pub fn multiple(self, multi: bool) -> Self { - self.multiple_occurrences(multi).multiple_values(multi) + pub fn multiple(self, yes: bool) -> Self { + self.multiple_occurrences(yes).multiple_values(yes) } /// Consume all following arguments. @@ -4548,11 +4548,11 @@ impl<'help> Arg<'help> { /// [`Arg::allow_hyphen_values(true)`]: Arg::allow_hyphen_values() /// [`Arg::last(true)`]: Arg::last() #[inline] - pub fn raw(self, raw: bool) -> Self { - self.takes_value(raw) - .multiple_values(raw) - .allow_hyphen_values(raw) - .last(raw) + pub fn raw(self, yes: bool) -> Self { + self.takes_value(yes) + .multiple_values(yes) + .allow_hyphen_values(yes) + .last(yes) } /// Hides an argument from short help (`-h`). @@ -4625,8 +4625,8 @@ impl<'help> Arg<'help> { /// -V, --version Print version information /// ``` #[inline] - pub fn hide_short_help(self, hide: bool) -> Self { - if hide { + pub fn hide_short_help(self, yes: bool) -> Self { + if yes { self.setting(ArgSettings::HiddenShortHelp) } else { self.unset_setting(ArgSettings::HiddenShortHelp) @@ -4636,8 +4636,8 @@ impl<'help> Arg<'help> { /// Deprecated, replaced with [`Arg::hide_short_help`] #[deprecated(since = "3.0.0", note = "Replaced with `Arg::hide_short_help`")] #[inline] - pub fn hidden_short_help(self, h: bool) -> Self { - self.hide_short_help(h) + pub fn hidden_short_help(self, yes: bool) -> Self { + self.hide_short_help(yes) } /// Hides an argument from long help (`--help`). @@ -4704,8 +4704,8 @@ impl<'help> Arg<'help> { /// -V, --version Print version information /// ``` #[inline] - pub fn hide_long_help(self, hide: bool) -> Self { - if hide { + pub fn hide_long_help(self, yes: bool) -> Self { + if yes { self.setting(ArgSettings::HiddenLongHelp) } else { self.unset_setting(ArgSettings::HiddenLongHelp) @@ -4715,8 +4715,8 @@ impl<'help> Arg<'help> { /// Deprecated, replaced with [`Arg::hide_long_help`] #[deprecated(since = "3.0.0", note = "Replaced with `Arg::hide_long_help`")] #[inline] - pub fn hidden_long_help(self, h: bool) -> Self { - self.hide_long_help(h) + pub fn hidden_long_help(self, yes: bool) -> Self { + self.hide_long_help(yes) } /// Check if the [`ArgSettings`] variant is currently set on the argument. diff --git a/src/build/arg_group.rs b/src/build/arg_group.rs index 22faf189..0515f61c 100644 --- a/src/build/arg_group.rs +++ b/src/build/arg_group.rs @@ -238,8 +238,8 @@ impl<'help> ArgGroup<'help> { /// /// [`Arg`]: crate::Arg #[inline] - pub fn multiple(mut self, m: bool) -> Self { - self.multiple = m; + pub fn multiple(mut self, yes: bool) -> Self { + self.multiple = yes; self } @@ -279,8 +279,8 @@ impl<'help> ArgGroup<'help> { /// [`ArgGroup::multiple`]: ArgGroup::multiple() /// [`App`]: crate::App #[inline] - pub fn required(mut self, r: bool) -> Self { - self.required = r; + pub fn required(mut self, yes: bool) -> Self { + self.required = yes; self }