Auto merge of #10168 - hi-rustin:rustin-patch-flag, r=ehuss

Unify the description of quiet flag

cc: #8928
I seem to have missed it.
This commit is contained in:
bors 2021-12-06 21:54:44 +00:00
commit 40dc281755
33 changed files with 36 additions and 32 deletions

View file

@ -453,7 +453,7 @@ See 'cargo help <command>' for more information on a specific command.\n",
.multiple(true) .multiple(true)
.global(true), .global(true),
) )
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg( .arg(
opt("color", "Coloring: auto, always, never") opt("color", "Coloring: auto, always, never")
.value_name("WHEN") .value_name("WHEN")

View file

@ -5,7 +5,7 @@ pub fn cli() -> App {
subcommand("bench") subcommand("bench")
.setting(AppSettings::TrailingVarArg) .setting(AppSettings::TrailingVarArg)
.about("Execute all benchmarks of a local package") .about("Execute all benchmarks of a local package")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg( .arg(
Arg::with_name("BENCHNAME") Arg::with_name("BENCHNAME")
.help("If specified, only run benches containing this string in their names"), .help("If specified, only run benches containing this string in their names"),

View file

@ -7,7 +7,7 @@ pub fn cli() -> App {
// subcommand aliases are handled in aliased_command() // subcommand aliases are handled in aliased_command()
// .alias("b") // .alias("b")
.about("Compile a local package and all of its dependencies") .about("Compile a local package and all of its dependencies")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg_package_spec( .arg_package_spec(
"Package to build (see `cargo help pkgid`)", "Package to build (see `cargo help pkgid`)",
"Build all packages in the workspace", "Build all packages in the workspace",

View file

@ -7,7 +7,7 @@ pub fn cli() -> App {
// subcommand aliases are handled in aliased_command() // subcommand aliases are handled in aliased_command()
// .alias("c") // .alias("c")
.about("Check a local package and all of its dependencies for errors") .about("Check a local package and all of its dependencies for errors")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg_package_spec( .arg_package_spec(
"Package(s) to check", "Package(s) to check",
"Check all packages in the workspace", "Check all packages in the workspace",

View file

@ -6,7 +6,7 @@ use cargo::util::print_available_packages;
pub fn cli() -> App { pub fn cli() -> App {
subcommand("clean") subcommand("clean")
.about("Remove artifacts that cargo has generated in the past") .about("Remove artifacts that cargo has generated in the past")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg_package_spec_simple("Package to clean artifacts for") .arg_package_spec_simple("Package to clean artifacts for")
.arg_manifest_path() .arg_manifest_path()
.arg_target_triple("Target triple to clean output for") .arg_target_triple("Target triple to clean output for")

View file

@ -7,7 +7,7 @@ pub fn cli() -> App {
// subcommand aliases are handled in aliased_command() // subcommand aliases are handled in aliased_command()
// .alias("d") // .alias("d")
.about("Build a package's documentation") .about("Build a package's documentation")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg(opt( .arg(opt(
"open", "open",
"Opens the docs in a browser after the operation", "Opens the docs in a browser after the operation",

View file

@ -6,7 +6,7 @@ use cargo::ops::FetchOptions;
pub fn cli() -> App { pub fn cli() -> App {
subcommand("fetch") subcommand("fetch")
.about("Fetch dependencies of a package from the network") .about("Fetch dependencies of a package from the network")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg_manifest_path() .arg_manifest_path()
.arg_target_triple("Fetch dependencies for the target triple") .arg_target_triple("Fetch dependencies for the target triple")
.after_help("Run `cargo help fetch` for more detailed information.\n") .after_help("Run `cargo help fetch` for more detailed information.\n")

View file

@ -5,7 +5,7 @@ use cargo::ops::{self, CompileFilter, FilterRule, LibRule};
pub fn cli() -> App { pub fn cli() -> App {
subcommand("fix") subcommand("fix")
.about("Automatically fix lint warnings reported by rustc") .about("Automatically fix lint warnings reported by rustc")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg_package_spec( .arg_package_spec(
"Package(s) to fix", "Package(s) to fix",
"Fix all packages in the workspace", "Fix all packages in the workspace",

View file

@ -5,7 +5,7 @@ use cargo::ops;
pub fn cli() -> App { pub fn cli() -> App {
subcommand("generate-lockfile") subcommand("generate-lockfile")
.about("Generate the lockfile for a package") .about("Generate the lockfile for a package")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg_manifest_path() .arg_manifest_path()
.after_help("Run `cargo help generate-lockfile` for more detailed information.\n") .after_help("Run `cargo help generate-lockfile` for more detailed information.\n")
} }

View file

@ -5,7 +5,7 @@ use cargo::ops;
pub fn cli() -> App { pub fn cli() -> App {
subcommand("init") subcommand("init")
.about("Create a new cargo package in an existing directory") .about("Create a new cargo package in an existing directory")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg(Arg::with_name("path").default_value(".")) .arg(Arg::with_name("path").default_value("."))
.arg(opt("registry", "Registry to use").value_name("REGISTRY")) .arg(opt("registry", "Registry to use").value_name("REGISTRY"))
.arg_new_opts() .arg_new_opts()

View file

@ -7,7 +7,7 @@ use cargo::util::IntoUrl;
pub fn cli() -> App { pub fn cli() -> App {
subcommand("install") subcommand("install")
.about("Install a Rust binary. Default location is $HOME/.cargo/bin") .about("Install a Rust binary. Default location is $HOME/.cargo/bin")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg(Arg::with_name("crate").empty_values(false).multiple(true)) .arg(Arg::with_name("crate").empty_values(false).multiple(true))
.arg( .arg(
opt("version", "Specify a version to install") opt("version", "Specify a version to install")

View file

@ -6,7 +6,7 @@ use serde::Serialize;
pub fn cli() -> App { pub fn cli() -> App {
subcommand("locate-project") subcommand("locate-project")
.about("Print a JSON representation of a Cargo.toml file's location") .about("Print a JSON representation of a Cargo.toml file's location")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg_manifest_path() .arg_manifest_path()
.arg( .arg(
opt( opt(

View file

@ -8,7 +8,7 @@ pub fn cli() -> App {
"Save an api token from the registry locally. \ "Save an api token from the registry locally. \
If token is not specified, it will be read from stdin.", If token is not specified, it will be read from stdin.",
) )
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg(Arg::with_name("token")) .arg(Arg::with_name("token"))
// --host is deprecated (use --registry instead) // --host is deprecated (use --registry instead)
.arg( .arg(

View file

@ -4,7 +4,7 @@ use cargo::ops;
pub fn cli() -> App { pub fn cli() -> App {
subcommand("logout") subcommand("logout")
.about("Remove an API token from the registry locally") .about("Remove an API token from the registry locally")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg(opt("registry", "Registry to use").value_name("REGISTRY")) .arg(opt("registry", "Registry to use").value_name("REGISTRY"))
.after_help("Run `cargo help logout` for more detailed information.\n") .after_help("Run `cargo help logout` for more detailed information.\n")
} }

View file

@ -8,7 +8,7 @@ pub fn cli() -> App {
the concrete used versions including overrides, \ the concrete used versions including overrides, \
in machine-readable format", in machine-readable format",
) )
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg_features() .arg_features()
.arg(multi_opt( .arg(multi_opt(
"filter-platform", "filter-platform",

View file

@ -5,7 +5,7 @@ use cargo::ops;
pub fn cli() -> App { pub fn cli() -> App {
subcommand("new") subcommand("new")
.about("Create a new cargo package at <path>") .about("Create a new cargo package at <path>")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg(Arg::with_name("path").required(true)) .arg(Arg::with_name("path").required(true))
.arg(opt("registry", "Registry to use").value_name("REGISTRY")) .arg(opt("registry", "Registry to use").value_name("REGISTRY"))
.arg_new_opts() .arg_new_opts()

View file

@ -5,7 +5,7 @@ use cargo::ops::{self, OwnersOptions};
pub fn cli() -> App { pub fn cli() -> App {
subcommand("owner") subcommand("owner")
.about("Manage the owners of a crate on the registry") .about("Manage the owners of a crate on the registry")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg(Arg::with_name("crate")) .arg(Arg::with_name("crate"))
.arg( .arg(
multi_opt( multi_opt(

View file

@ -5,7 +5,7 @@ use cargo::ops::{self, PackageOpts};
pub fn cli() -> App { pub fn cli() -> App {
subcommand("package") subcommand("package")
.about("Assemble the local package into a distributable tarball") .about("Assemble the local package into a distributable tarball")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg( .arg(
opt( opt(
"list", "list",

View file

@ -6,7 +6,7 @@ use cargo::util::print_available_packages;
pub fn cli() -> App { pub fn cli() -> App {
subcommand("pkgid") subcommand("pkgid")
.about("Print a fully qualified package specification") .about("Print a fully qualified package specification")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg(Arg::with_name("spec")) .arg(Arg::with_name("spec"))
.arg_package("Argument to get the package ID specifier for") .arg_package("Argument to get the package ID specifier for")
.arg_manifest_path() .arg_manifest_path()

View file

@ -5,7 +5,7 @@ use cargo::ops::{self, PublishOpts};
pub fn cli() -> App { pub fn cli() -> App {
subcommand("publish") subcommand("publish")
.about("Upload a package to the registry") .about("Upload a package to the registry")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg_index() .arg_index()
.arg(opt("token", "Token to use when uploading").value_name("TOKEN")) .arg(opt("token", "Token to use when uploading").value_name("TOKEN"))
.arg(opt( .arg(opt(

View file

@ -9,7 +9,7 @@ Print a JSON representation of a Cargo.toml manifest.
Deprecated, use `cargo metadata --no-deps` instead.\ Deprecated, use `cargo metadata --no-deps` instead.\
", ",
) )
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg_manifest_path() .arg_manifest_path()
} }

View file

@ -10,7 +10,7 @@ pub fn cli() -> App {
// .alias("r") // .alias("r")
.setting(AppSettings::TrailingVarArg) .setting(AppSettings::TrailingVarArg)
.about("Run a binary or example of the local package") .about("Run a binary or example of the local package")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg(Arg::with_name("args").multiple(true)) .arg(Arg::with_name("args").multiple(true))
.arg_targets_bin_example( .arg_targets_bin_example(
"Name of the bin target to run", "Name of the bin target to run",

View file

@ -9,7 +9,7 @@ pub fn cli() -> App {
subcommand("rustc") subcommand("rustc")
.setting(AppSettings::TrailingVarArg) .setting(AppSettings::TrailingVarArg)
.about("Compile a package, and pass extra options to the compiler") .about("Compile a package, and pass extra options to the compiler")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg(Arg::with_name("args").multiple(true).help("Rustc flags")) .arg(Arg::with_name("args").multiple(true).help("Rustc flags"))
.arg_package("Package to build") .arg_package("Package to build")
.arg_jobs() .arg_jobs()

View file

@ -6,7 +6,7 @@ pub fn cli() -> App {
subcommand("rustdoc") subcommand("rustdoc")
.setting(AppSettings::TrailingVarArg) .setting(AppSettings::TrailingVarArg)
.about("Build a package's documentation, using specified custom flags.") .about("Build a package's documentation, using specified custom flags.")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg(Arg::with_name("args").multiple(true)) .arg(Arg::with_name("args").multiple(true))
.arg(opt( .arg(opt(
"open", "open",

View file

@ -7,7 +7,7 @@ use cargo::ops;
pub fn cli() -> App { pub fn cli() -> App {
subcommand("search") subcommand("search")
.about("Search packages in crates.io") .about("Search packages in crates.io")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg(Arg::with_name("query").multiple(true)) .arg(Arg::with_name("query").multiple(true))
.arg_index() .arg_index()
.arg( .arg(

View file

@ -12,7 +12,7 @@ use std::str::FromStr;
pub fn cli() -> App { pub fn cli() -> App {
subcommand("tree") subcommand("tree")
.about("Display a tree visualization of a dependency graph") .about("Display a tree visualization of a dependency graph")
.arg(opt("quiet", "Suppress status messages").short("q")) .arg_quiet()
.arg_manifest_path() .arg_manifest_path()
.arg_package_spec_no_all( .arg_package_spec_no_all(
"Package to be used as the root of the tree", "Package to be used as the root of the tree",

View file

@ -5,7 +5,7 @@ use cargo::ops;
pub fn cli() -> App { pub fn cli() -> App {
subcommand("uninstall") subcommand("uninstall")
.about("Remove a Rust binary") .about("Remove a Rust binary")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg(Arg::with_name("spec").multiple(true)) .arg(Arg::with_name("spec").multiple(true))
.arg_package_spec_simple("Package to uninstall") .arg_package_spec_simple("Package to uninstall")
.arg(multi_opt("bin", "NAME", "Only uninstall the binary NAME")) .arg(multi_opt("bin", "NAME", "Only uninstall the binary NAME"))

View file

@ -6,7 +6,7 @@ use cargo::util::print_available_packages;
pub fn cli() -> App { pub fn cli() -> App {
subcommand("update") subcommand("update")
.about("Update dependencies as recorded in the local lock file") .about("Update dependencies as recorded in the local lock file")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg(opt("workspace", "Only update the workspace packages").short("w")) .arg(opt("workspace", "Only update the workspace packages").short("w"))
.arg_package_spec_simple("Package to update") .arg_package_spec_simple("Package to update")
.arg(opt( .arg(opt(

View file

@ -5,7 +5,7 @@ use std::path::PathBuf;
pub fn cli() -> App { pub fn cli() -> App {
subcommand("vendor") subcommand("vendor")
.about("Vendor all dependencies for a project locally") .about("Vendor all dependencies for a project locally")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg_manifest_path() .arg_manifest_path()
.arg(Arg::with_name("path").help("Where to vendor crates (`vendor` by default)")) .arg(Arg::with_name("path").help("Where to vendor crates (`vendor` by default)"))
.arg( .arg(

View file

@ -6,7 +6,7 @@ use std::process;
pub fn cli() -> App { pub fn cli() -> App {
subcommand("verify-project") subcommand("verify-project")
.about("Check correctness of crate manifest") .about("Check correctness of crate manifest")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg_manifest_path() .arg_manifest_path()
.after_help("Run `cargo help verify-project` for more detailed information.\n") .after_help("Run `cargo help verify-project` for more detailed information.\n")
} }

View file

@ -4,7 +4,7 @@ use crate::command_prelude::*;
pub fn cli() -> App { pub fn cli() -> App {
subcommand("version") subcommand("version")
.about("Show version information") .about("Show version information")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.after_help("Run `cargo help version` for more detailed information.\n") .after_help("Run `cargo help version` for more detailed information.\n")
} }

View file

@ -5,7 +5,7 @@ use cargo::ops;
pub fn cli() -> App { pub fn cli() -> App {
subcommand("yank") subcommand("yank")
.about("Remove a pushed crate from the index") .about("Remove a pushed crate from the index")
.arg(opt("quiet", "Do not print cargo log messages").short("q")) .arg_quiet()
.arg(Arg::with_name("crate")) .arg(Arg::with_name("crate"))
.arg( .arg(
opt("vers", "The version to yank or un-yank") opt("vers", "The version to yank or un-yank")

View file

@ -236,6 +236,10 @@ pub trait AppExt: Sized {
"Outputs a future incompatibility report at the end of the build", "Outputs a future incompatibility report at the end of the build",
)) ))
} }
fn arg_quiet(self) -> Self {
self._arg(opt("quiet", "Do not print cargo log messages").short("q"))
}
} }
impl AppExt for App { impl AppExt for App {