From 274484dfd08fff4859cefd7e9bef3b73d3a9cb5f Mon Sep 17 00:00:00 2001 From: Kevin K Date: Mon, 29 Jun 2015 22:03:05 -0400 Subject: [PATCH] imp: removes deprecated functions in prep for 1.0 --- src/app.rs | 19 -------- src/args/arg.rs | 99 ------------------------------------------ src/args/subcommand.rs | 17 -------- 3 files changed, 135 deletions(-) diff --git a/src/app.rs b/src/app.rs index 5464e2b8b69..8bfb0748d90 100644 --- a/src/app.rs +++ b/src/app.rs @@ -264,25 +264,6 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{ self } - /// **WARNING:** This method is deprecated. Use `.subcommand_required(true)` instead. - /// - /// Allows specifying that if no subcommand is present at runtime, error and exit gracefully - /// - /// **NOTE:** This defaults to false (subcommands do *not* need to be present) - /// - /// # Example - /// - /// ```no_run - /// # use clap::App; - /// App::new("myprog") - /// .subcommands_negate_reqs(true) - /// # ; - /// ``` - pub fn error_on_no_subcommand(mut self, n: bool) -> App<'a, 'v, 'ab, 'u, 'h, 'ar> { - self.no_sc_error = n; - self - } - /// Allows specifying that if no subcommand is present at runtime, error and exit gracefully /// /// **NOTE:** This defaults to false (subcommands do *not* need to be present) diff --git a/src/args/arg.rs b/src/args/arg.rs index 79ea98ebb0b..f874f21ac89 100644 --- a/src/args/arg.rs +++ b/src/args/arg.rs @@ -94,50 +94,6 @@ pub struct Arg<'n, 'l, 'h, 'g, 'p, 'r> { } impl<'n, 'l, 'h, 'g, 'p, 'r> Arg<'n, 'l, 'h, 'g, 'p, 'r> { - /// **WARNING:** This function is deprecated. Use `Arg::with_name()` instead. - /// - /// Creates a new instace of `Arg` using a unique string name. - /// The name will be used by the library consumer to get information about - /// whether or not the argument was used at runtime. - /// - /// **NOTE:** in the case of arguments that take values (i.e. `takes_value(true)`) - /// and positional arguments (i.e. those without a `-` or `--`) the name will also - /// be displayed when the user prints the usage/help information of the program. - /// - /// - /// - /// # Example - /// - /// ```no_run - /// # use clap::{App, Arg}; - /// # let matches = App::new("myprog") - /// # .arg( - /// Arg::new("conifg") - /// # .short("c") - /// # ).get_matches(); - pub fn new(n: &'n str) -> Arg<'n, 'l, 'h, 'g, 'p, 'r> { - Arg { - name: n, - short: None, - long: None, - help: None, - required: false, - takes_value: false, - multiple: false, - index: None, - possible_vals: None, - blacklist: None, - requires: None, - group: None, - num_vals: None, - val_names: None, - max_vals: None, - min_vals: None, - global: false, - empty_vals: true, - } - } - /// Creates a new instace of `Arg` using a unique string name. /// The name will be used by the library consumer to get information about /// whether or not the argument was used at runtime. @@ -428,61 +384,6 @@ impl<'n, 'l, 'h, 'g, 'p, 'r> Arg<'n, 'l, 'h, 'g, 'p, 'r> { self } - /// **WARNING:** This method is deprecated. Use `.conflicts_with()` instead. - /// - /// Sets a mutually exclusive argument by name. I.e. when using this argument, - /// the following argument can't be present. - /// - /// **NOTE:** Mutually exclusive rules take precedence over being required - /// by default. Mutually exclusive rules only need to be set for one of the two - /// arguments, they do not need to be set for each. - /// - /// # Example - /// - /// ```no_run - /// # use clap::{App, Arg}; - /// # let myprog = App::new("myprog").arg(Arg::with_name("conifg") - /// .mutually_excludes("debug") - /// # ).get_matches(); - pub fn mutually_excludes(mut self, name: &'r str) -> Arg<'n, 'l, 'h, 'g, 'p, 'r> { - if let Some(ref mut vec) = self.blacklist { - vec.push(name); - } else { - let v = vec![name]; - self.blacklist = Some(v); - } - self - } - - /// **WARNING:** This method is deprecated. Use `conflicts_with_all()` instead. - /// - /// Sets a mutually exclusive arguments by names. I.e. when using this argument, - /// the following argument can't be present. - /// - /// **NOTE:** Mutually exclusive rules take precedence over being required - /// by default. Mutually exclusive rules only need to be set for one of the two - /// arguments, they do not need to be set for each. - /// - /// # Example - /// - /// ```no_run - /// # use clap::{App, Arg}; - /// let conf_excludes = ["debug", "input"]; - /// # let myprog = App::new("myprog").arg(Arg::with_name("conifg") - /// .mutually_excludes_all(&conf_excludes) - /// # ).get_matches(); - pub fn mutually_excludes_all(mut self, names: I) - -> Arg<'n, 'l, 'h, 'g, 'p, 'r> - where T: AsRef + 'r, - I: IntoIterator { - if let Some(ref mut vec) = self.blacklist { - names.into_iter().map(|s| vec.push(s.as_ref())).collect::>(); - } else { - self.blacklist = Some(names.into_iter().map(|s| s.as_ref()).collect::>()); - } - self - } - /// Sets a mutually exclusive argument by name. I.e. when using this argument, /// the following argument can't be present. /// diff --git a/src/args/subcommand.rs b/src/args/subcommand.rs index 5a6ff5fff1d..559d3eea111 100644 --- a/src/args/subcommand.rs +++ b/src/args/subcommand.rs @@ -42,21 +42,4 @@ impl<'n, 'a> SubCommand<'n, 'a> { pub fn with_name<'au, 'v, 'ab, 'u, 'h, 'ar>(name: &'ar str) -> App<'au, 'v, 'ab, 'u, 'h, 'ar> { App::new(name) } - - /// **WARNING:** This function is deprecated. Use `SubCommand::with_name()` instead. - /// - /// Creates a new instance of a subcommand requiring a name. Will be displayed - /// to the user when they print version or help and usage information. - /// - /// # Example - /// - /// ```no_run - /// # use clap::{App, Arg, SubCommand}; - /// # let prog = App::new("myprog").subcommand( - /// SubCommand::new("config") - /// # ).get_matches(); - /// ``` - pub fn new<'au, 'v, 'ab, 'u, 'h, 'ar>(name: &'ar str) -> App<'au, 'v, 'ab, 'u, 'h, 'ar> { - App::new(name) - } }