From 72845c01391221dc5675ba2b9864b4e7dbfdb514 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Mon, 23 May 2022 21:57:12 +0200 Subject: [PATCH 1/3] Update clap from 0.2 to 0.3 --- Cargo.lock | 56 +-------- cargo-dinghy/Cargo.toml | 2 +- cargo-dinghy/src/cli.rs | 259 ++++++++++++++++++++------------------- cargo-dinghy/src/main.rs | 27 ++-- dinghy-lib/Cargo.toml | 2 +- 5 files changed, 158 insertions(+), 188 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 91e50833..6636f0d3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -26,15 +26,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - [[package]] name = "anyhow" version = "1.0.57" @@ -134,7 +125,7 @@ dependencies = [ "bytesize", "cargo-platform", "cargo-util", - "clap 3.1.18", + "clap", "crates-io", "crossbeam-utils", "curl", @@ -185,7 +176,7 @@ dependencies = [ name = "cargo-dinghy" version = "0.4.72-pre" dependencies = [ - "clap 2.34.0", + "clap", "dinghy-lib", "env_logger", "error-chain", @@ -239,21 +230,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "clap" -version = "2.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" -dependencies = [ - "ansi_term", - "atty", - "bitflags", - "strsim 0.8.0", - "textwrap 0.11.0", - "unicode-width", - "vec_map", -] - [[package]] name = "clap" version = "3.1.18" @@ -264,9 +240,10 @@ dependencies = [ "bitflags", "clap_lex", "indexmap", - "strsim 0.10.0", + "lazy_static", + "strsim", "termcolor", - "textwrap 0.15.0", + "textwrap", ] [[package]] @@ -414,7 +391,7 @@ dependencies = [ "anyhow", "atty", "cargo", - "clap 2.34.0", + "clap", "core-foundation", "core-foundation-sys", "dinghy-build", @@ -1342,12 +1319,6 @@ dependencies = [ "vte", ] -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - [[package]] name = "strsim" version = "0.10.0" @@ -1420,15 +1391,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - [[package]] name = "textwrap" version = "0.15.0" @@ -1575,12 +1537,6 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version_check" version = "0.9.4" diff --git a/cargo-dinghy/Cargo.toml b/cargo-dinghy/Cargo.toml index 9db1e189..b9ac1106 100644 --- a/cargo-dinghy/Cargo.toml +++ b/cargo-dinghy/Cargo.toml @@ -20,6 +20,6 @@ travis-ci = { repository = "snipsco/dinghy" } dinghy-lib = { path = "../dinghy-lib" } error-chain = "0.12" log = "0.4" -clap = "2.32" +clap = { version = "3.1", features = ["cargo"] } env_logger = "0.9" openssl-sys = { features = [ "vendored" ], version = "0.9" } diff --git a/cargo-dinghy/src/cli.rs b/cargo-dinghy/src/cli.rs index dc56c54b..d1c72c64 100644 --- a/cargo-dinghy/src/cli.rs +++ b/cargo-dinghy/src/cli.rs @@ -9,134 +9,133 @@ use std::ffi::OsString; pub struct CargoDinghyCli {} +fn default_app() -> App<'static> { + App::new("dinghy") + .version(crate_version!()) + .device() + .verbose() + .quiet() + .overlay() + .platform() + .subcommand( + SubCommand::with_name("all-devices") + .about("List all devices that can be used with Dinghy"), + ) + .subcommand( + SubCommand::with_name("all-platforms").about("List all platforms known to dinghy"), + ) + .subcommand( + SubCommand::with_name("bench") + .about("Run the benchmarks") + .lib() + .bin() + .example() + .test() + .bench() + .package() + .all() + .exclude() + .job() + .features() + .no_default_features() + .no_run() + .all_features() + .common_remote() + .target() + .verbose() + .additional_args() + .strip() + .bearded(), + ) + .subcommand( + SubCommand::with_name("build") + .about("Compile the current project") + .package() + .all() + .exclude() + .job() + .lib() + .bin() + .example() + .test() + .bench() + .debug_or_release() + .features() + .all_features() + .no_default_features() + .target() + .verbose() + .additional_args() + .strip() + .bearded(), + ) + .subcommand( + SubCommand::with_name("clean") + .about("Remove artifacts that cargo has generated in the past"), + ) + .subcommand( + SubCommand::with_name("devices") + .about("List devices that can be used with Dinghy for the selected platform"), + ) + .subcommand(SubCommand::with_name("lldbproxy").about("Debug through lldb")) + .subcommand( + SubCommand::with_name("run") + .about("Build and execute src/main.rs") + .bin() + .example() + .package() + .job() + .debug_or_release() + .features() + .all_features() + .no_default_features() + .target() + .verbose() + .common_remote() + .additional_args() + .strip() + .bearded(), + ) + .subcommand( + SubCommand::with_name("test") + .about("Run the tests") + .lib() + .bin() + .example() + .test() + .bench() + .all() + .package() + .exclude() + .job() + .features() + .all_features() + .no_default_features() + .no_run() + .debug_or_release() + .target() + .verbose() + .common_remote() + .additional_args() + .strip() + .bearded(), + ) +} + impl CargoDinghyCli { - pub fn parse<'a, I, T>(args: I) -> ArgMatches<'a> + pub fn parse(args: I) -> ArgMatches where I: IntoIterator, T: Into + Clone, { - { - App::new("dinghy") - .version(crate_version!()) - .device() - .verbose() - .quiet() - .overlay() - .platform() - .subcommand( - SubCommand::with_name("all-devices") - .about("List all devices that can be used with Dinghy"), - ) - .subcommand( - SubCommand::with_name("all-platforms") - .about("List all platforms known to dinghy"), - ) - .subcommand( - SubCommand::with_name("bench") - .about("Run the benchmarks") - .lib() - .bin() - .example() - .test() - .bench() - .package() - .all() - .exclude() - .job() - .features() - .no_default_features() - .no_run() - .all_features() - .common_remote() - .target() - .verbose() - .additional_args() - .strip() - .bearded(), - ) - .subcommand( - SubCommand::with_name("build") - .about("Compile the current project") - .package() - .all() - .exclude() - .job() - .lib() - .bin() - .example() - .test() - .bench() - .debug_or_release() - .features() - .all_features() - .no_default_features() - .target() - .verbose() - .additional_args() - .strip() - .bearded(), - ) - .subcommand( - SubCommand::with_name("clean") - .about("Remove artifacts that cargo has generated in the past"), - ) - .subcommand( - SubCommand::with_name("devices").about( - "List devices that can be used with Dinghy for the selected platform", - ), - ) - .subcommand(SubCommand::with_name("lldbproxy").about("Debug through lldb")) - .subcommand( - SubCommand::with_name("run") - .about("Build and execute src/main.rs") - .bin() - .example() - .package() - .job() - .debug_or_release() - .features() - .all_features() - .no_default_features() - .target() - .verbose() - .common_remote() - .additional_args() - .strip() - .bearded(), - ) - .subcommand( - SubCommand::with_name("test") - .about("Run the tests") - .lib() - .bin() - .example() - .test() - .bench() - .all() - .package() - .exclude() - .job() - .features() - .all_features() - .no_default_features() - .no_run() - .debug_or_release() - .target() - .verbose() - .common_remote() - .additional_args() - .strip() - .bearded(), - ) - } - .get_matches_from(args) + default_app().get_matches_from(args) } pub fn build_args_from(matches: &ArgMatches) -> BuildArgs { BuildArgs { compile_mode: match matches.subcommand() { - ("bench", Some(_)) => CompileMode::Bench, - ("test", Some(_)) => CompileMode::Test, + Some(("bench", _)) => CompileMode::Bench, + Some(("test", _)) => CompileMode::Test, _ => CompileMode::Build, }, forced_overlays: arg_as_string_vec(matches, "OVERLAY"), @@ -173,7 +172,7 @@ pub trait CargoDinghyCliExt { fn bearded(self) -> Self; } -impl<'a, 'b> CargoDinghyCliExt for App<'a, 'b> { +impl<'a> CargoDinghyCliExt for App<'a> { fn additional_args(self) -> Self { self.arg(Arg::with_name("ARGS").multiple(true).help("test arguments")) } @@ -237,7 +236,7 @@ impl<'a, 'b> CargoDinghyCliExt for App<'a, 'b> { fn device(self) -> Self { self.arg( Arg::with_name("DEVICE") - .short("d") + .short('d') .long("device") .takes_value(true) .help("device hint"), @@ -286,7 +285,7 @@ impl<'a, 'b> CargoDinghyCliExt for App<'a, 'b> { self.arg( Arg::with_name("JOBS") .long("jobs") - .short("j") + .short('j') .takes_value(true) .help("number of concurrent jobs"), ) @@ -324,7 +323,7 @@ impl<'a, 'b> CargoDinghyCliExt for App<'a, 'b> { fn package(self) -> Self { self.arg( Arg::with_name("SPEC") - .short("p") + .short('p') .long("package") .takes_value(true) .multiple(true) @@ -336,7 +335,7 @@ impl<'a, 'b> CargoDinghyCliExt for App<'a, 'b> { fn overlay(self) -> Self { self.arg( Arg::with_name("OVERLAY") - .short("o") + .short('o') .long("overlay") .takes_value(true) .multiple(true) @@ -399,7 +398,7 @@ impl<'a, 'b> CargoDinghyCliExt for App<'a, 'b> { fn verbose(self) -> Self { self.arg( Arg::with_name("VERBOSE") - .short("v") + .short('v') .long("verbose") .multiple(true) .help("Raise the level of verbosity"), @@ -409,7 +408,7 @@ impl<'a, 'b> CargoDinghyCliExt for App<'a, 'b> { fn quiet(self) -> Self { self.arg( Arg::with_name("QUIET") - .short("q") + .short('q') .long("quiet") .multiple(true) .help("Lower the level of verbosity"), @@ -431,3 +430,13 @@ fn arg_as_string_vec(matches: &ArgMatches, option: &str) -> Vec { .map(|vs| vs.map(|s| s.to_string()).collect()) .unwrap_or(vec![]) } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn verify_app() { + default_app().debug_assert(); + } +} diff --git a/cargo-dinghy/src/main.rs b/cargo-dinghy/src/main.rs index 526dc124..1e53f44d 100644 --- a/cargo-dinghy/src/main.rs +++ b/cargo-dinghy/src/main.rs @@ -62,12 +62,16 @@ fn main() { fn run_command(args: &ArgMatches) -> Result<()> { let conf = Arc::new(dinghy_config(current_dir().unwrap())?); - let compiler = Arc::new(Compiler::from_args(args.subcommand().1.unwrap_or(args))?); + let compiler = Arc::new(Compiler::from_args( + args.subcommand() + .map(|(_, sub_args)| sub_args) + .unwrap_or(args), + )?); let dinghy = Dinghy::probe(&conf, &compiler)?; let project = Project::new(&conf); match args.subcommand() { - ("all-devices", Some(_)) => return show_all_devices(&dinghy), - ("all-platforms", Some(_)) => return show_all_platforms(&dinghy), + Some(("all-devices", _)) => return show_all_devices(&dinghy), + Some(("all-platforms", _)) => return show_all_platforms(&dinghy), _ => {} }; @@ -79,14 +83,15 @@ fn run_command(args: &ArgMatches) -> Result<()> { ); match args.subcommand() { - ("bench", Some(sub_args)) => prepare_and_run(device, project, platform, args, sub_args), - ("build", Some(sub_args)) => build(&platform, &project, args, sub_args).and(Ok(())), - ("clean", Some(_)) => compiler.clean(&**platform), - ("devices", Some(_)) => show_all_devices_for_platform(&dinghy, platform), - ("lldbproxy", Some(_)) => run_lldb(device), - ("run", Some(sub_args)) => prepare_and_run(device, project, platform, args, sub_args), - ("test", Some(sub_args)) => prepare_and_run(device, project, platform, args, sub_args), - (sub, _) => bail!("Unknown dinghy command '{}'", sub), + Some(("bench", sub_args)) => prepare_and_run(device, project, platform, args, sub_args), + Some(("build", sub_args)) => build(&platform, &project, args, sub_args).and(Ok(())), + Some(("clean", _)) => compiler.clean(&**platform), + Some(("devices", _)) => show_all_devices_for_platform(&dinghy, platform), + Some(("lldbproxy", _)) => run_lldb(device), + Some(("run", sub_args)) => prepare_and_run(device, project, platform, args, sub_args), + Some(("test", sub_args)) => prepare_and_run(device, project, platform, args, sub_args), + Some((sub, _)) => bail!("Unknown dinghy command '{}'", sub), + None => bail!("Unknown dinghy command"), } } diff --git a/dinghy-lib/Cargo.toml b/dinghy-lib/Cargo.toml index 98c41588..7dfbadb2 100644 --- a/dinghy-lib/Cargo.toml +++ b/dinghy-lib/Cargo.toml @@ -22,7 +22,7 @@ failure = "0.1.6" filetime = "0.2" log = "0.4" env_logger = "0.9" -clap = "2.33" +clap = "3.1" cargo = "0.62" atty = "0.2" itertools = "0.10" From f5d7359277c859a3358487556d3003d2b1f79f44 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Mon, 23 May 2022 21:58:23 +0200 Subject: [PATCH 2/3] Fix usage of clap::Arg::multiple --- cargo-dinghy/src/cli.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cargo-dinghy/src/cli.rs b/cargo-dinghy/src/cli.rs index d1c72c64..2d055e56 100644 --- a/cargo-dinghy/src/cli.rs +++ b/cargo-dinghy/src/cli.rs @@ -174,7 +174,11 @@ pub trait CargoDinghyCliExt { impl<'a> CargoDinghyCliExt for App<'a> { fn additional_args(self) -> Self { - self.arg(Arg::with_name("ARGS").multiple(true).help("test arguments")) + self.arg( + Arg::with_name("ARGS") + .multiple_occurrences(true) + .help("test arguments"), + ) } fn all(self) -> Self { @@ -228,7 +232,7 @@ impl<'a> CargoDinghyCliExt for App<'a> { Arg::with_name("ENVS") .long("env") .takes_value(true) - .multiple(true) + .multiple_values(true) .help("Space-separated list of env variables to set e.g. RUST_TRACE=trace"), ) } @@ -257,7 +261,6 @@ impl<'a> CargoDinghyCliExt for App<'a> { Arg::with_name("EXCLUDE") .long("exclude") .takes_value(true) - .multiple(true) .number_of_values(1) .help("Exclude package to from the build"), ) @@ -326,7 +329,6 @@ impl<'a> CargoDinghyCliExt for App<'a> { .short('p') .long("package") .takes_value(true) - .multiple(true) .number_of_values(1) .help("Package to bench, build, run or test"), ) @@ -338,7 +340,6 @@ impl<'a> CargoDinghyCliExt for App<'a> { .short('o') .long("overlay") .takes_value(true) - .multiple(true) .number_of_values(1) .help("Force the use of an overlay during project build"), ) @@ -400,7 +401,7 @@ impl<'a> CargoDinghyCliExt for App<'a> { Arg::with_name("VERBOSE") .short('v') .long("verbose") - .multiple(true) + .multiple_occurrences(true) .help("Raise the level of verbosity"), ) } @@ -410,7 +411,7 @@ impl<'a> CargoDinghyCliExt for App<'a> { Arg::with_name("QUIET") .short('q') .long("quiet") - .multiple(true) + .multiple_occurrences(true) .help("Lower the level of verbosity"), ) } From 7b38e793756d1a08d5aca13843d3658173c32e8f Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Mon, 23 May 2022 21:57:58 +0200 Subject: [PATCH 3/3] Fix clap warnings --- cargo-dinghy/src/cli.rs | 91 +++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 48 deletions(-) diff --git a/cargo-dinghy/src/cli.rs b/cargo-dinghy/src/cli.rs index 2d055e56..e59553cb 100644 --- a/cargo-dinghy/src/cli.rs +++ b/cargo-dinghy/src/cli.rs @@ -1,16 +1,15 @@ -use clap::App; use clap::Arg; use clap::ArgGroup; use clap::ArgMatches; -use clap::SubCommand; +use clap::Command; use dinghy_lib::compiler::CompileMode; use dinghy_lib::BuildArgs; use std::ffi::OsString; pub struct CargoDinghyCli {} -fn default_app() -> App<'static> { - App::new("dinghy") +fn default_app() -> Command<'static> { + Command::new("dinghy") .version(crate_version!()) .device() .verbose() @@ -18,14 +17,11 @@ fn default_app() -> App<'static> { .overlay() .platform() .subcommand( - SubCommand::with_name("all-devices") - .about("List all devices that can be used with Dinghy"), + Command::new("all-devices").about("List all devices that can be used with Dinghy"), ) + .subcommand(Command::new("all-platforms").about("List all platforms known to dinghy")) .subcommand( - SubCommand::with_name("all-platforms").about("List all platforms known to dinghy"), - ) - .subcommand( - SubCommand::with_name("bench") + Command::new("bench") .about("Run the benchmarks") .lib() .bin() @@ -48,7 +44,7 @@ fn default_app() -> App<'static> { .bearded(), ) .subcommand( - SubCommand::with_name("build") + Command::new("build") .about("Compile the current project") .package() .all() @@ -70,16 +66,15 @@ fn default_app() -> App<'static> { .bearded(), ) .subcommand( - SubCommand::with_name("clean") - .about("Remove artifacts that cargo has generated in the past"), + Command::new("clean").about("Remove artifacts that cargo has generated in the past"), ) .subcommand( - SubCommand::with_name("devices") + Command::new("devices") .about("List devices that can be used with Dinghy for the selected platform"), ) - .subcommand(SubCommand::with_name("lldbproxy").about("Debug through lldb")) + .subcommand(Command::new("lldbproxy").about("Debug through lldb")) .subcommand( - SubCommand::with_name("run") + Command::new("run") .about("Build and execute src/main.rs") .bin() .example() @@ -97,7 +92,7 @@ fn default_app() -> App<'static> { .bearded(), ) .subcommand( - SubCommand::with_name("test") + Command::new("test") .about("Run the tests") .lib() .bin() @@ -172,10 +167,10 @@ pub trait CargoDinghyCliExt { fn bearded(self) -> Self; } -impl<'a> CargoDinghyCliExt for App<'a> { +impl<'a> CargoDinghyCliExt for Command<'a> { fn additional_args(self) -> Self { self.arg( - Arg::with_name("ARGS") + Arg::new("ARGS") .multiple_occurrences(true) .help("test arguments"), ) @@ -183,7 +178,7 @@ impl<'a> CargoDinghyCliExt for App<'a> { fn all(self) -> Self { self.arg( - Arg::with_name("ALL") + Arg::new("ALL") .long("all") .help("Build all packages in the workspace"), ) @@ -191,7 +186,7 @@ impl<'a> CargoDinghyCliExt for App<'a> { fn all_features(self) -> Self { self.arg( - Arg::with_name("ALL_FEATURES") + Arg::new("ALL_FEATURES") .long("all-features") .help("Build all available features"), ) @@ -199,7 +194,7 @@ impl<'a> CargoDinghyCliExt for App<'a> { fn bench(self) -> Self { self.arg( - Arg::with_name("BENCH") + Arg::new("BENCH") .long("bench") .takes_value(true) .help("only the specified benchmark target"), @@ -208,7 +203,7 @@ impl<'a> CargoDinghyCliExt for App<'a> { fn bin(self) -> Self { self.arg( - Arg::with_name("BIN") + Arg::new("BIN") .long("bin") .takes_value(true) .help("only the specified binary"), @@ -217,19 +212,19 @@ impl<'a> CargoDinghyCliExt for App<'a> { fn common_remote(self) -> Self { self.arg( - Arg::with_name("CLEANUP") + Arg::new("CLEANUP") .long("cleanup") .takes_value(false) .help("cleanup device after complete"), ) .arg( - Arg::with_name("DEBUGGER") + Arg::new("DEBUGGER") .long("debugger") .takes_value(false) .help("just start debugger"), ) .arg( - Arg::with_name("ENVS") + Arg::new("ENVS") .long("env") .takes_value(true) .multiple_values(true) @@ -239,7 +234,7 @@ impl<'a> CargoDinghyCliExt for App<'a> { fn device(self) -> Self { self.arg( - Arg::with_name("DEVICE") + Arg::new("DEVICE") .short('d') .long("device") .takes_value(true) @@ -249,7 +244,7 @@ impl<'a> CargoDinghyCliExt for App<'a> { fn example(self) -> Self { self.arg( - Arg::with_name("EXAMPLE") + Arg::new("EXAMPLE") .long("example") .takes_value(true) .help("only the specified example"), @@ -258,7 +253,7 @@ impl<'a> CargoDinghyCliExt for App<'a> { fn exclude(self) -> Self { self.arg( - Arg::with_name("EXCLUDE") + Arg::new("EXCLUDE") .long("exclude") .takes_value(true) .number_of_values(1) @@ -268,7 +263,7 @@ impl<'a> CargoDinghyCliExt for App<'a> { fn exe(self) -> Self { self.arg( - Arg::with_name("EXE") + Arg::new("EXE") .long("exe") .takes_value(true) .help("Executable to strip"), @@ -277,7 +272,7 @@ impl<'a> CargoDinghyCliExt for App<'a> { fn features(self) -> Self { self.arg( - Arg::with_name("FEATURES") + Arg::new("FEATURES") .long("features") .takes_value(true) .help("Space-separated list of features to also build"), @@ -286,7 +281,7 @@ impl<'a> CargoDinghyCliExt for App<'a> { fn job(self) -> Self { self.arg( - Arg::with_name("JOBS") + Arg::new("JOBS") .long("jobs") .short('j') .takes_value(true) @@ -295,12 +290,12 @@ impl<'a> CargoDinghyCliExt for App<'a> { } fn lib(self) -> Self { - self.arg(Arg::with_name("LIB").long("lib").help("only the library")) + self.arg(Arg::new("LIB").long("lib").help("only the library")) } fn no_default_features(self) -> Self { self.arg( - Arg::with_name("NO_DEFAULT_FEATURES") + Arg::new("NO_DEFAULT_FEATURES") .long("no-default-features") .help("Do not build the `default` feature"), ) @@ -308,7 +303,7 @@ impl<'a> CargoDinghyCliExt for App<'a> { fn no_run(self) -> Self { self.arg( - Arg::with_name("NO_RUN") + Arg::new("NO_RUN") .long("no-run") .help("Compile, but don't run tests or benches"), ) @@ -316,7 +311,7 @@ impl<'a> CargoDinghyCliExt for App<'a> { fn strip(self) -> Self { self.arg( - Arg::with_name("STRIP") + Arg::new("STRIP") .long("strip") .takes_value(false) .help("strip the final executable (will have '-stripped' extension)"), @@ -325,7 +320,7 @@ impl<'a> CargoDinghyCliExt for App<'a> { fn package(self) -> Self { self.arg( - Arg::with_name("SPEC") + Arg::new("SPEC") .short('p') .long("package") .takes_value(true) @@ -336,7 +331,7 @@ impl<'a> CargoDinghyCliExt for App<'a> { fn overlay(self) -> Self { self.arg( - Arg::with_name("OVERLAY") + Arg::new("OVERLAY") .short('o') .long("overlay") .takes_value(true) @@ -347,7 +342,7 @@ impl<'a> CargoDinghyCliExt for App<'a> { fn platform(self) -> Self { self.arg( - Arg::with_name("PLATFORM") + Arg::new("PLATFORM") .long("platform") .takes_value(true) .help("Use a specific platform (build only)"), @@ -356,23 +351,23 @@ impl<'a> CargoDinghyCliExt for App<'a> { fn debug_or_release(self) -> Self { self.arg( - Arg::with_name("RELEASE") + Arg::new("RELEASE") .long("release") .help("Build artifacts in release mode, with optimizations"), ) .arg( - Arg::with_name("DEBUG") + Arg::new("DEBUG") .long("debug") .help("Build artifacts in debug mode, without optimizations"), ) .arg( - Arg::with_name("PROFILE") + Arg::new("PROFILE") .long("profile") .takes_value(true) .help("Build artifacts with the specified profile"), ) .group( - ArgGroup::with_name("BUILD_TYPE") + ArgGroup::new("BUILD_TYPE") .args(&["DEBUG", "RELEASE", "PROFILE"]) .multiple(false), ) @@ -380,7 +375,7 @@ impl<'a> CargoDinghyCliExt for App<'a> { fn target(self) -> Self { self.arg( - Arg::with_name("TARGET") + Arg::new("TARGET") .long("target") .takes_value(true) .help("target triple (rust conventions)"), @@ -389,7 +384,7 @@ impl<'a> CargoDinghyCliExt for App<'a> { fn test(self) -> Self { self.arg( - Arg::with_name("TEST") + Arg::new("TEST") .long("test") .takes_value(true) .help("only the specified integration test target"), @@ -398,7 +393,7 @@ impl<'a> CargoDinghyCliExt for App<'a> { fn verbose(self) -> Self { self.arg( - Arg::with_name("VERBOSE") + Arg::new("VERBOSE") .short('v') .long("verbose") .multiple_occurrences(true) @@ -408,7 +403,7 @@ impl<'a> CargoDinghyCliExt for App<'a> { fn quiet(self) -> Self { self.arg( - Arg::with_name("QUIET") + Arg::new("QUIET") .short('q') .long("quiet") .multiple_occurrences(true) @@ -418,7 +413,7 @@ impl<'a> CargoDinghyCliExt for App<'a> { fn bearded(self) -> Self { self.arg( - Arg::with_name("BEARDED") + Arg::new("BEARDED") .long("bearded") .help("Do some naughty stuff"), )