mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
breaking(DisableVersionForSubcommands): removed
This commit removes `AppSettings::DisableVersionForSubcommand` as it's now a moot setting with clap's default functionality of not building a version flag unless there actually exists version information. `clap_up` must still be changed to remove this variant instead of the current configuration to simply rename the variant.
This commit is contained in:
parent
9fbe5841a7
commit
7b45695878
4 changed files with 4 additions and 35 deletions
|
@ -11,6 +11,9 @@ TODO: `YamlLoader`
|
|||
* **Renamed Features**
|
||||
* `unicode_help` to `unicode` to encompass more functionality
|
||||
|
||||
* **Removed Settings**
|
||||
* `AppSettings::DisableVersionForSubcommands`
|
||||
|
||||
<a name="v3.0.0-beta.4"></a>
|
||||
## v3.0.0-beta.4 (2021-08-14)
|
||||
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -42,6 +42,7 @@ pub fn runner() -> Runner {
|
|||
&[
|
||||
["DisableHelpFlags", "DisableHelpFlag"],
|
||||
["DisableVersion", "DisableVersionFlag"],
|
||||
// @TODO @v3 shoud be removed, not renamed
|
||||
["VersionlessSubcommands", "DisableVersionForSubcommands"],
|
||||
],
|
||||
)
|
||||
|
|
|
@ -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::<AppSettings>().unwrap(),
|
||||
AppSettings::UnifiedHelpMessage
|
||||
);
|
||||
assert_eq!(
|
||||
"disableversionforsubcommands"
|
||||
.parse::<AppSettings>()
|
||||
.unwrap(),
|
||||
AppSettings::DisableVersionForSubcommands
|
||||
);
|
||||
assert_eq!(
|
||||
"waitonerror".parse::<AppSettings>().unwrap(),
|
||||
AppSettings::WaitOnError
|
||||
|
|
Loading…
Reference in a new issue