diff --git a/CHANGELOG.md b/CHANGELOG.md index e5271d3c..9d127ba7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ TODO: `YamlLoader` * **Renamed Features** * `unicode_help` to `unicode` to encompass more functionality +* **Removed Settings** + * `AppSettings::DisableVersionForSubcommands` + ## v3.0.0-beta.4 (2021-08-14) diff --git a/benches/06_rustup.rs b/benches/06_rustup.rs index bf48af2f..faf0a1cb 100644 --- a/benches/06_rustup.rs +++ b/benches/06_rustup.rs @@ -26,7 +26,6 @@ fn build_cli() -> App<'static> { .version("0.9.0") // Simulating .about("The Rust toolchain installer") .after_help(RUSTUP_HELP) - .setting(AppSettings::DisableVersionForSubcommands) .setting(AppSettings::DeriveDisplayOrder) // .setting(AppSettings::SubcommandRequiredElseHelp) .arg( @@ -107,7 +106,6 @@ fn build_cli() -> App<'static> { .subcommand( App::new("target") .about("Modify a toolchain's supported targets") - .setting(AppSettings::DisableVersionForSubcommands) .setting(AppSettings::DeriveDisplayOrder) // .setting(AppSettings::SubcommandRequiredElseHelp) .subcommand( @@ -163,7 +161,6 @@ fn build_cli() -> App<'static> { .subcommand( App::new("component") .about("Modify a toolchain's installed components") - .setting(AppSettings::DisableVersionForSubcommands) .setting(AppSettings::DeriveDisplayOrder) // .setting(AppSettings::SubcommandRequiredElseHelp) .subcommand( @@ -210,7 +207,6 @@ fn build_cli() -> App<'static> { App::new("override") .about("Modify directory toolchain overrides") .after_help(OVERRIDE_HELP) - .setting(AppSettings::DisableVersionForSubcommands) .setting(AppSettings::DeriveDisplayOrder) // .setting(AppSettings::SubcommandRequiredElseHelp) .subcommand(App::new("list").about("List directory toolchain overrides")) @@ -304,7 +300,6 @@ fn build_cli() -> App<'static> { .subcommand( App::new("self") .about("Modify the rustup installation") - .setting(AppSettings::DisableVersionForSubcommands) .setting(AppSettings::DeriveDisplayOrder) .subcommand(App::new("update").about("Download and install updates to rustup")) .subcommand( @@ -318,7 +313,6 @@ fn build_cli() -> App<'static> { App::new("telemetry") .about("rustup telemetry commands") .setting(AppSettings::Hidden) - .setting(AppSettings::DisableVersionForSubcommands) .setting(AppSettings::DeriveDisplayOrder) .subcommand(App::new("enable").about("Enable rustup telemetry")) .subcommand(App::new("disable").about("Disable rustup telemetry")) diff --git a/clap_up/src/lib.rs b/clap_up/src/lib.rs index ee87ec79..ffe45ae9 100644 --- a/clap_up/src/lib.rs +++ b/clap_up/src/lib.rs @@ -42,6 +42,7 @@ pub fn runner() -> Runner { &[ ["DisableHelpFlags", "DisableHelpFlag"], ["DisableVersion", "DisableVersionFlag"], + // @TODO @v3 shoud be removed, not renamed ["VersionlessSubcommands", "DisableVersionForSubcommands"], ], ) diff --git a/src/build/app/settings.rs b/src/build/app/settings.rs index 045d966b..5efd8c7a 100644 --- a/src/build/app/settings.rs +++ b/src/build/app/settings.rs @@ -130,8 +130,6 @@ impl_settings! { AppSettings, AppFlags, => Flags::NEXT_LINE_HELP, IgnoreErrors("ignoreerrors") => Flags::IGNORE_ERRORS, - DisableVersionForSubcommands("disableversionforsubcommands") - => Flags::DISABLE_VERSION_FOR_SC, WaitOnError("waitonerror") => Flags::WAIT_ON_ERROR, Built("built") @@ -653,27 +651,6 @@ pub enum AppSettings { /// ``` DisableVersionFlag, - /// Disables `-V` and `--version` for all [`subcommands`] of this [`App`]. - /// - /// # Examples - /// - /// ```rust - /// # use clap::{App, AppSettings, ErrorKind}; - /// let res = App::new("myprog") - /// .version("v1.1") - /// .setting(AppSettings::DisableVersionForSubcommands) - /// .subcommand(App::new("test")) - /// .try_get_matches_from(vec![ - /// "myprog", "test", "-V" - /// ]); - /// assert!(res.is_err()); - /// assert_eq!(res.unwrap_err().kind, ErrorKind::UnknownArgument); - /// ``` - /// - /// [`subcommands`]: crate::App::subcommand() - /// [`App`]: crate::App - DisableVersionForSubcommands, - /// Displays the arguments and [`subcommands`] in the help message in the order that they were /// declared in, and not alphabetically which is the default. /// @@ -1215,12 +1192,6 @@ mod test { "unifiedhelpmessage".parse::().unwrap(), AppSettings::UnifiedHelpMessage ); - assert_eq!( - "disableversionforsubcommands" - .parse::() - .unwrap(), - AppSettings::DisableVersionForSubcommands - ); assert_eq!( "waitonerror".parse::().unwrap(), AppSettings::WaitOnError