mirror of https://github.com/rust-lang/cargo
refactor: Resolve clap deprecations
This commit is contained in:
parent
96948f7a24
commit
69ba69f908
|
@ -3,7 +3,6 @@ use cargo::ops::{self, TestOptions};
|
||||||
|
|
||||||
pub fn cli() -> Command {
|
pub fn cli() -> Command {
|
||||||
subcommand("bench")
|
subcommand("bench")
|
||||||
.trailing_var_arg(true)
|
|
||||||
.about("Execute all benchmarks of a local package")
|
.about("Execute all benchmarks of a local package")
|
||||||
.arg_quiet()
|
.arg_quiet()
|
||||||
.arg(
|
.arg(
|
||||||
|
@ -14,7 +13,8 @@ pub fn cli() -> Command {
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("args")
|
Arg::new("args")
|
||||||
.help("Arguments for the bench binary")
|
.help("Arguments for the bench binary")
|
||||||
.num_args(0..),
|
.num_args(0..)
|
||||||
|
.trailing_var_arg(true),
|
||||||
)
|
)
|
||||||
.arg_targets_all(
|
.arg_targets_all(
|
||||||
"Benchmark only this package's library",
|
"Benchmark only this package's library",
|
||||||
|
|
|
@ -8,13 +8,13 @@ pub fn cli() -> Command {
|
||||||
subcommand("run")
|
subcommand("run")
|
||||||
// subcommand aliases are handled in aliased_command()
|
// subcommand aliases are handled in aliased_command()
|
||||||
// .alias("r")
|
// .alias("r")
|
||||||
.trailing_var_arg(true)
|
|
||||||
.about("Run a binary or example of the local package")
|
.about("Run a binary or example of the local package")
|
||||||
.arg_quiet()
|
.arg_quiet()
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("args")
|
Arg::new("args")
|
||||||
.value_parser(value_parser!(std::ffi::OsString))
|
.value_parser(value_parser!(std::ffi::OsString))
|
||||||
.num_args(0..),
|
.num_args(0..)
|
||||||
|
.trailing_var_arg(true),
|
||||||
)
|
)
|
||||||
.arg_targets_bin_example(
|
.arg_targets_bin_example(
|
||||||
"Name of the bin target to run",
|
"Name of the bin target to run",
|
||||||
|
|
|
@ -7,10 +7,14 @@ const CRATE_TYPE_ARG_NAME: &str = "crate-type";
|
||||||
|
|
||||||
pub fn cli() -> Command {
|
pub fn cli() -> Command {
|
||||||
subcommand("rustc")
|
subcommand("rustc")
|
||||||
.trailing_var_arg(true)
|
|
||||||
.about("Compile a package, and pass extra options to the compiler")
|
.about("Compile a package, and pass extra options to the compiler")
|
||||||
.arg_quiet()
|
.arg_quiet()
|
||||||
.arg(Arg::new("args").num_args(0..).help("Rustc flags"))
|
.arg(
|
||||||
|
Arg::new("args")
|
||||||
|
.num_args(0..)
|
||||||
|
.help("Rustc flags")
|
||||||
|
.trailing_var_arg(true),
|
||||||
|
)
|
||||||
.arg_package("Package to build")
|
.arg_package("Package to build")
|
||||||
.arg_jobs()
|
.arg_jobs()
|
||||||
.arg_targets_all(
|
.arg_targets_all(
|
||||||
|
|
|
@ -4,10 +4,9 @@ use crate::command_prelude::*;
|
||||||
|
|
||||||
pub fn cli() -> Command {
|
pub fn cli() -> Command {
|
||||||
subcommand("rustdoc")
|
subcommand("rustdoc")
|
||||||
.trailing_var_arg(true)
|
|
||||||
.about("Build a package's documentation, using specified custom flags.")
|
.about("Build a package's documentation, using specified custom flags.")
|
||||||
.arg_quiet()
|
.arg_quiet()
|
||||||
.arg(Arg::new("args").num_args(0..))
|
.arg(Arg::new("args").num_args(0..).trailing_var_arg(true))
|
||||||
.arg(flag(
|
.arg(flag(
|
||||||
"open",
|
"open",
|
||||||
"Opens the docs in a browser after the operation",
|
"Opens the docs in a browser after the operation",
|
||||||
|
|
|
@ -5,7 +5,6 @@ pub fn cli() -> Command {
|
||||||
subcommand("test")
|
subcommand("test")
|
||||||
// Subcommand aliases are handled in `aliased_command()`.
|
// Subcommand aliases are handled in `aliased_command()`.
|
||||||
// .alias("t")
|
// .alias("t")
|
||||||
.trailing_var_arg(true)
|
|
||||||
.about("Execute all unit and integration tests and build examples of a local package")
|
.about("Execute all unit and integration tests and build examples of a local package")
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("TESTNAME")
|
Arg::new("TESTNAME")
|
||||||
|
@ -15,7 +14,8 @@ pub fn cli() -> Command {
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("args")
|
Arg::new("args")
|
||||||
.help("Arguments for the test binary")
|
.help("Arguments for the test binary")
|
||||||
.num_args(0..),
|
.num_args(0..)
|
||||||
|
.trailing_var_arg(true),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
flag(
|
flag(
|
||||||
|
|
Loading…
Reference in New Issue