From 372842aac6e7093509f787ab9b38a303315ff7cc Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 18 Jan 2022 16:17:36 -0600 Subject: [PATCH] refactor: Move from deprecated Arg::with_name --- examples/nop-preprocessor.rs | 2 +- src/cmd/init.rs | 4 ++-- src/cmd/serve.rs | 4 ++-- src/cmd/test.rs | 2 +- src/main.rs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/nop-preprocessor.rs b/examples/nop-preprocessor.rs index d53d8745..69fb87f4 100644 --- a/examples/nop-preprocessor.rs +++ b/examples/nop-preprocessor.rs @@ -12,7 +12,7 @@ pub fn make_app() -> App<'static> { .about("A mdbook preprocessor which does precisely nothing") .subcommand( SubCommand::with_name("supports") - .arg(Arg::with_name("renderer").required(true)) + .arg(Arg::new("renderer").required(true)) .about("Check whether a renderer is supported by this preprocessor"), ) } diff --git a/src/cmd/init.rs b/src/cmd/init.rs index d777c081..b9e08872 100644 --- a/src/cmd/init.rs +++ b/src/cmd/init.rs @@ -19,14 +19,14 @@ pub fn make_subcommand<'help>() -> App<'help> { .arg_from_usage("--theme 'Copies the default theme into your source folder'") .arg_from_usage("--force 'Skips confirmation prompts'") .arg( - Arg::with_name("title") + Arg::new("title") .long("title") .takes_value(true) .help("Sets the book title") .required(false), ) .arg( - Arg::with_name("ignore") + Arg::new("ignore") .long("ignore") .takes_value(true) .possible_values(&["none", "git"]) diff --git a/src/cmd/serve.rs b/src/cmd/serve.rs index 0b46a1e5..fcc06b40 100644 --- a/src/cmd/serve.rs +++ b/src/cmd/serve.rs @@ -31,7 +31,7 @@ pub fn make_subcommand<'help>() -> App<'help> { (Defaults to the Current Directory when omitted)'", ) .arg( - Arg::with_name("hostname") + Arg::new("hostname") .short('n') .long("hostname") .takes_value(true) @@ -40,7 +40,7 @@ pub fn make_subcommand<'help>() -> App<'help> { .help("Hostname to listen on for HTTP connections"), ) .arg( - Arg::with_name("port") + Arg::new("port") .short('p') .long("port") .takes_value(true) diff --git a/src/cmd/test.rs b/src/cmd/test.rs index 50470793..ba7aa6c9 100644 --- a/src/cmd/test.rs +++ b/src/cmd/test.rs @@ -16,7 +16,7 @@ pub fn make_subcommand<'help>() -> App<'help> { "[dir] 'Root directory for the book{n}\ (Defaults to the Current Directory when omitted)'", ) - .arg(Arg::with_name("library-path") + .arg(Arg::new("library-path") .short('L') .long("library-path") .value_name("dir") diff --git a/src/main.rs b/src/main.rs index 36f0fc02..37c85c43 100644 --- a/src/main.rs +++ b/src/main.rs @@ -81,7 +81,7 @@ fn create_clap_app() -> App<'static> { SubCommand::with_name("completions") .about("Generate shell completions for your shell to stdout") .arg( - Arg::with_name("shell") + Arg::new("shell") .takes_value(true) .possible_values(Shell::possible_values()) .help("the shell to generate completions for")