refactor: Move from deprecated Arg::with_name

This commit is contained in:
Ed Page 2022-01-18 16:17:36 -06:00
parent 7934e06668
commit 372842aac6
5 changed files with 7 additions and 7 deletions

View File

@ -12,7 +12,7 @@ pub fn make_app() -> App<'static> {
.about("A mdbook preprocessor which does precisely nothing") .about("A mdbook preprocessor which does precisely nothing")
.subcommand( .subcommand(
SubCommand::with_name("supports") 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"), .about("Check whether a renderer is supported by this preprocessor"),
) )
} }

View File

@ -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("--theme 'Copies the default theme into your source folder'")
.arg_from_usage("--force 'Skips confirmation prompts'") .arg_from_usage("--force 'Skips confirmation prompts'")
.arg( .arg(
Arg::with_name("title") Arg::new("title")
.long("title") .long("title")
.takes_value(true) .takes_value(true)
.help("Sets the book title") .help("Sets the book title")
.required(false), .required(false),
) )
.arg( .arg(
Arg::with_name("ignore") Arg::new("ignore")
.long("ignore") .long("ignore")
.takes_value(true) .takes_value(true)
.possible_values(&["none", "git"]) .possible_values(&["none", "git"])

View File

@ -31,7 +31,7 @@ pub fn make_subcommand<'help>() -> App<'help> {
(Defaults to the Current Directory when omitted)'", (Defaults to the Current Directory when omitted)'",
) )
.arg( .arg(
Arg::with_name("hostname") Arg::new("hostname")
.short('n') .short('n')
.long("hostname") .long("hostname")
.takes_value(true) .takes_value(true)
@ -40,7 +40,7 @@ pub fn make_subcommand<'help>() -> App<'help> {
.help("Hostname to listen on for HTTP connections"), .help("Hostname to listen on for HTTP connections"),
) )
.arg( .arg(
Arg::with_name("port") Arg::new("port")
.short('p') .short('p')
.long("port") .long("port")
.takes_value(true) .takes_value(true)

View File

@ -16,7 +16,7 @@ pub fn make_subcommand<'help>() -> App<'help> {
"[dir] 'Root directory for the book{n}\ "[dir] 'Root directory for the book{n}\
(Defaults to the Current Directory when omitted)'", (Defaults to the Current Directory when omitted)'",
) )
.arg(Arg::with_name("library-path") .arg(Arg::new("library-path")
.short('L') .short('L')
.long("library-path") .long("library-path")
.value_name("dir") .value_name("dir")

View File

@ -81,7 +81,7 @@ fn create_clap_app() -> App<'static> {
SubCommand::with_name("completions") SubCommand::with_name("completions")
.about("Generate shell completions for your shell to stdout") .about("Generate shell completions for your shell to stdout")
.arg( .arg(
Arg::with_name("shell") Arg::new("shell")
.takes_value(true) .takes_value(true)
.possible_values(Shell::possible_values()) .possible_values(Shell::possible_values())
.help("the shell to generate completions for") .help("the shell to generate completions for")