mirror of
https://github.com/clap-rs/clap
synced 2025-03-04 23:37:32 +00:00
depr(SubCommand::with_name): deprecates SubCommand facade to prefer App::new
This commit is contained in:
parent
a9cbf3e5b9
commit
c22bc3e1fc
1 changed files with 15 additions and 25 deletions
|
@ -36,33 +36,23 @@ pub struct SubCommand<'a> {
|
|||
}
|
||||
|
||||
impl<'a> SubCommand<'a> {
|
||||
/// Creates a new instance of a subcommand requiring a name. The name will be displayed
|
||||
/// to the user when they print version or help and usage information.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust
|
||||
/// # use clap::{App, Arg, SubCommand};
|
||||
/// App::new("myprog")
|
||||
/// .subcommand(
|
||||
/// SubCommand::with_name("config"))
|
||||
/// # ;
|
||||
/// ```
|
||||
// @TODO-v3-beta: remove
|
||||
/// **Deprecated**
|
||||
#[deprecated(
|
||||
since = "2.32.0",
|
||||
note = "Use App::new instead. Will be removed in v3-beta"
|
||||
)]
|
||||
pub fn with_name<'b>(name: &str) -> App<'a, 'b> { App::new(name) }
|
||||
|
||||
/// Creates a new instance of a subcommand from a YAML (.yml) document
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```ignore
|
||||
/// # #[macro_use]
|
||||
/// # extern crate clap;
|
||||
/// # use clap::Subcommand;
|
||||
/// # fn main() {
|
||||
/// let sc_yaml = load_yaml!("test_subcommand.yml");
|
||||
/// let sc = SubCommand::from_yaml(sc_yaml);
|
||||
/// # }
|
||||
/// ```
|
||||
// @TODO-v3-beta: remove
|
||||
/// **Deprecated**
|
||||
#[cfg_attr(
|
||||
feature = "yaml",
|
||||
deprecated(
|
||||
since = "2.32.0",
|
||||
note = "Use App::from instead. Will be removed in v3-beta"
|
||||
)
|
||||
)]
|
||||
#[cfg(feature = "yaml")]
|
||||
pub fn from_yaml(yaml: &Yaml) -> App { App::from_yaml(yaml) }
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue