mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 06:42:33 +00:00
Merge pull request #3150 from japert/improve-subcommand-deprecation-message
Improve `SubCommand` deprecation message.
This commit is contained in:
commit
378e8d733d
1 changed files with 7 additions and 3 deletions
10
src/lib.rs
10
src/lib.rs
|
@ -74,14 +74,18 @@ const INTERNAL_ERROR_MSG: &str = "Fatal internal error. Please consider filing a
|
||||||
report at https://github.com/clap-rs/clap/issues";
|
report at https://github.com/clap-rs/clap/issues";
|
||||||
const INVALID_UTF8: &str = "unexpected invalid UTF-8 code point";
|
const INVALID_UTF8: &str = "unexpected invalid UTF-8 code point";
|
||||||
|
|
||||||
/// Deprecated, replaced with [`App`]
|
/// Deprecated, replaced with [`App::new`], unless you were looking for [Subcommand]
|
||||||
#[deprecated(since = "3.0.0", note = "Replaced with `App`")]
|
#[deprecated(
|
||||||
|
since = "3.0.0",
|
||||||
|
note = "Replaced with `App::new` unless you intended the `Subcommand` trait"
|
||||||
|
)]
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
pub struct SubCommand {}
|
pub struct SubCommand {}
|
||||||
|
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
impl SubCommand {
|
impl SubCommand {
|
||||||
/// Deprecated, replaced with [`App::new`]
|
/// Deprecated, replaced with [`App::new`].
|
||||||
|
/// Did you mean Subcommand (lower-case c)?
|
||||||
#[deprecated(since = "3.0.0", note = "Replaced with `App::new`")]
|
#[deprecated(since = "3.0.0", note = "Replaced with `App::new`")]
|
||||||
pub fn with_name<'help>(name: &str) -> App<'help> {
|
pub fn with_name<'help>(name: &str) -> App<'help> {
|
||||||
App::new(name)
|
App::new(name)
|
||||||
|
|
Loading…
Reference in a new issue