imp: removes deprecated functions in prep for 1.0

This commit is contained in:
Kevin K 2015-06-29 22:03:05 -04:00
parent d0da3bdd9d
commit 274484dfd0
3 changed files with 0 additions and 135 deletions

View file

@ -264,25 +264,6 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
self 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 /// 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) /// **NOTE:** This defaults to false (subcommands do *not* need to be present)

View file

@ -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> { 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. /// Creates a new instace of `Arg` using a unique string name.
/// The name will be used by the library consumer to get information about /// The name will be used by the library consumer to get information about
/// whether or not the argument was used at runtime. /// 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 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<T, I>(mut self, names: I)
-> Arg<'n, 'l, 'h, 'g, 'p, 'r>
where T: AsRef<str> + 'r,
I: IntoIterator<Item=&'r T> {
if let Some(ref mut vec) = self.blacklist {
names.into_iter().map(|s| vec.push(s.as_ref())).collect::<Vec<_>>();
} else {
self.blacklist = Some(names.into_iter().map(|s| s.as_ref()).collect::<Vec<_>>());
}
self
}
/// Sets a mutually exclusive argument by name. I.e. when using this argument, /// Sets a mutually exclusive argument by name. I.e. when using this argument,
/// the following argument can't be present. /// the following argument can't be present.
/// ///

View file

@ -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> { pub fn with_name<'au, 'v, 'ab, 'u, 'h, 'ar>(name: &'ar str) -> App<'au, 'v, 'ab, 'u, 'h, 'ar> {
App::new(name) 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)
}
} }