Rename setting DisableHelpFlags => DisableHelpFlag

This commit is contained in:
Pavan Kumar Sunkara 2020-10-10 14:05:45 +02:00
parent 9c672510f3
commit 45f0ee8b55
4 changed files with 15 additions and 10 deletions

View file

@ -8,6 +8,11 @@ TODO: `cargo`, `std` features
#### Minimum Required Rust #### Minimum Required Rust
* As of this release, `clap` requires `rustc 1.42.0` or greater. * As of this release, `clap` requires `rustc 1.42.0` or greater.
#### BREAKING CHANGES
* **Renamed Settings**
* `AppSettings::DisableHelpFlags` => `AppSettings::DisableHelpFlag`
#### Features #### Features
* **Added Methods** * **Added Methods**

View file

@ -2356,7 +2356,7 @@ impl<'help> App<'help> {
.args .args
.iter() .iter()
.any(|x| x.long == Some("help") || x.id == Id::help_hash()) .any(|x| x.long == Some("help") || x.id == Id::help_hash())
|| self.is_set(AppSettings::DisableHelpFlags) || self.is_set(AppSettings::DisableHelpFlag)
|| self || self
.subcommands .subcommands
.iter() .iter()

View file

@ -48,7 +48,7 @@ bitflags! {
const ARGS_OVERRIDE_SELF = 1 << 39; const ARGS_OVERRIDE_SELF = 1 << 39;
const HELP_REQUIRED = 1 << 40; const HELP_REQUIRED = 1 << 40;
const SUBCOMMAND_PRECEDENCE_OVER_ARG = 1 << 41; const SUBCOMMAND_PRECEDENCE_OVER_ARG = 1 << 41;
const DISABLE_HELP_FLAGS = 1 << 42; const DISABLE_HELP_FLAG = 1 << 42;
} }
} }
@ -101,8 +101,8 @@ impl_settings! { AppSettings, AppFlags,
=> Flags::DERIVE_DISP_ORDER, => Flags::DERIVE_DISP_ORDER,
DisableHelpSubcommand("disablehelpsubcommand") DisableHelpSubcommand("disablehelpsubcommand")
=> Flags::DISABLE_HELP_SC, => Flags::DISABLE_HELP_SC,
DisableHelpFlags("disablehelpflags") DisableHelpFlag("disablehelpflag")
=> Flags::DISABLE_HELP_FLAGS, => Flags::DISABLE_HELP_FLAG,
DisableVersion("disableversion") DisableVersion("disableversion")
=> Flags::DISABLE_VERSION, => Flags::DISABLE_VERSION,
GlobalVersion("globalversion") GlobalVersion("globalversion")
@ -613,7 +613,7 @@ pub enum AppSettings {
/// ```rust /// ```rust
/// # use clap::{App, AppSettings, ErrorKind}; /// # use clap::{App, AppSettings, ErrorKind};
/// let res = App::new("myprog") /// let res = App::new("myprog")
/// .setting(AppSettings::DisableHelpFlags) /// .setting(AppSettings::DisableHelpFlag)
/// .try_get_matches_from(vec![ /// .try_get_matches_from(vec![
/// "myprog", "-h" /// "myprog", "-h"
/// ]); /// ]);
@ -624,7 +624,7 @@ pub enum AppSettings {
/// ```rust /// ```rust
/// # use clap::{App, AppSettings, ErrorKind}; /// # use clap::{App, AppSettings, ErrorKind};
/// let res = App::new("myprog") /// let res = App::new("myprog")
/// .setting(AppSettings::DisableHelpFlags) /// .setting(AppSettings::DisableHelpFlag)
/// .subcommand(App::new("test")) /// .subcommand(App::new("test"))
/// .try_get_matches_from(vec![ /// .try_get_matches_from(vec![
/// "myprog", "test", "-h" /// "myprog", "test", "-h"
@ -634,7 +634,7 @@ pub enum AppSettings {
/// ``` /// ```
/// [`SubCommand`]: ./struct.SubCommand.html /// [`SubCommand`]: ./struct.SubCommand.html
/// [`App`]: ./struct.App.html /// [`App`]: ./struct.App.html
DisableHelpFlags, DisableHelpFlag,
/// Disables the `help` subcommand /// Disables the `help` subcommand
/// ///
@ -1076,8 +1076,8 @@ mod test {
#[test] #[test]
fn app_settings_fromstr() { fn app_settings_fromstr() {
assert_eq!( assert_eq!(
"disablehelpflags".parse::<AppSettings>().unwrap(), "disablehelpflag".parse::<AppSettings>().unwrap(),
AppSettings::DisableHelpFlags AppSettings::DisableHelpFlag
); );
assert_eq!( assert_eq!(
"argsnegatesubcommands".parse::<AppSettings>().unwrap(), "argsnegatesubcommands".parse::<AppSettings>().unwrap(),

View file

@ -1919,7 +1919,7 @@ This is after help.
fn after_help_no_args() { fn after_help_no_args() {
let mut app = App::new("myapp") let mut app = App::new("myapp")
.version("1.0") .version("1.0")
.setting(AppSettings::DisableHelpFlags) .setting(AppSettings::DisableHelpFlag)
.setting(AppSettings::DisableVersion) .setting(AppSettings::DisableVersion)
.after_help("This is after help."); .after_help("This is after help.");