Skip to content

Commit 40dc281

Browse files
committed
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.
2 parents 263b169 + a3e3ff9 commit 40dc281

33 files changed

+36
-32
lines changed

src/bin/cargo/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ See 'cargo help <command>' for more information on a specific command.\n",
453453
.multiple(true)
454454
.global(true),
455455
)
456-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
456+
.arg_quiet()
457457
.arg(
458458
opt("color", "Coloring: auto, always, never")
459459
.value_name("WHEN")

src/bin/cargo/commands/bench.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pub fn cli() -> App {
55
subcommand("bench")
66
.setting(AppSettings::TrailingVarArg)
77
.about("Execute all benchmarks of a local package")
8-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
8+
.arg_quiet()
99
.arg(
1010
Arg::with_name("BENCHNAME")
1111
.help("If specified, only run benches containing this string in their names"),

src/bin/cargo/commands/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub fn cli() -> App {
77
// subcommand aliases are handled in aliased_command()
88
// .alias("b")
99
.about("Compile a local package and all of its dependencies")
10-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
10+
.arg_quiet()
1111
.arg_package_spec(
1212
"Package to build (see `cargo help pkgid`)",
1313
"Build all packages in the workspace",

src/bin/cargo/commands/check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub fn cli() -> App {
77
// subcommand aliases are handled in aliased_command()
88
// .alias("c")
99
.about("Check a local package and all of its dependencies for errors")
10-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
10+
.arg_quiet()
1111
.arg_package_spec(
1212
"Package(s) to check",
1313
"Check all packages in the workspace",

src/bin/cargo/commands/clean.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use cargo::util::print_available_packages;
66
pub fn cli() -> App {
77
subcommand("clean")
88
.about("Remove artifacts that cargo has generated in the past")
9-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
9+
.arg_quiet()
1010
.arg_package_spec_simple("Package to clean artifacts for")
1111
.arg_manifest_path()
1212
.arg_target_triple("Target triple to clean output for")

src/bin/cargo/commands/doc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub fn cli() -> App {
77
// subcommand aliases are handled in aliased_command()
88
// .alias("d")
99
.about("Build a package's documentation")
10-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
10+
.arg_quiet()
1111
.arg(opt(
1212
"open",
1313
"Opens the docs in a browser after the operation",

src/bin/cargo/commands/fetch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use cargo::ops::FetchOptions;
66
pub fn cli() -> App {
77
subcommand("fetch")
88
.about("Fetch dependencies of a package from the network")
9-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
9+
.arg_quiet()
1010
.arg_manifest_path()
1111
.arg_target_triple("Fetch dependencies for the target triple")
1212
.after_help("Run `cargo help fetch` for more detailed information.\n")

src/bin/cargo/commands/fix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use cargo::ops::{self, CompileFilter, FilterRule, LibRule};
55
pub fn cli() -> App {
66
subcommand("fix")
77
.about("Automatically fix lint warnings reported by rustc")
8-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
8+
.arg_quiet()
99
.arg_package_spec(
1010
"Package(s) to fix",
1111
"Fix all packages in the workspace",

src/bin/cargo/commands/generate_lockfile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use cargo::ops;
55
pub fn cli() -> App {
66
subcommand("generate-lockfile")
77
.about("Generate the lockfile for a package")
8-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
8+
.arg_quiet()
99
.arg_manifest_path()
1010
.after_help("Run `cargo help generate-lockfile` for more detailed information.\n")
1111
}

src/bin/cargo/commands/init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use cargo::ops;
55
pub fn cli() -> App {
66
subcommand("init")
77
.about("Create a new cargo package in an existing directory")
8-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
8+
.arg_quiet()
99
.arg(Arg::with_name("path").default_value("."))
1010
.arg(opt("registry", "Registry to use").value_name("REGISTRY"))
1111
.arg_new_opts()

src/bin/cargo/commands/install.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use cargo::util::IntoUrl;
77
pub fn cli() -> App {
88
subcommand("install")
99
.about("Install a Rust binary. Default location is $HOME/.cargo/bin")
10-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
10+
.arg_quiet()
1111
.arg(Arg::with_name("crate").empty_values(false).multiple(true))
1212
.arg(
1313
opt("version", "Specify a version to install")

src/bin/cargo/commands/locate_project.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use serde::Serialize;
66
pub fn cli() -> App {
77
subcommand("locate-project")
88
.about("Print a JSON representation of a Cargo.toml file's location")
9-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
9+
.arg_quiet()
1010
.arg_manifest_path()
1111
.arg(
1212
opt(

src/bin/cargo/commands/login.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub fn cli() -> App {
88
"Save an api token from the registry locally. \
99
If token is not specified, it will be read from stdin.",
1010
)
11-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
11+
.arg_quiet()
1212
.arg(Arg::with_name("token"))
1313
// --host is deprecated (use --registry instead)
1414
.arg(

src/bin/cargo/commands/logout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use cargo::ops;
44
pub fn cli() -> App {
55
subcommand("logout")
66
.about("Remove an API token from the registry locally")
7-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
7+
.arg_quiet()
88
.arg(opt("registry", "Registry to use").value_name("REGISTRY"))
99
.after_help("Run `cargo help logout` for more detailed information.\n")
1010
}

src/bin/cargo/commands/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub fn cli() -> App {
88
the concrete used versions including overrides, \
99
in machine-readable format",
1010
)
11-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
11+
.arg_quiet()
1212
.arg_features()
1313
.arg(multi_opt(
1414
"filter-platform",

src/bin/cargo/commands/new.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use cargo::ops;
55
pub fn cli() -> App {
66
subcommand("new")
77
.about("Create a new cargo package at <path>")
8-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
8+
.arg_quiet()
99
.arg(Arg::with_name("path").required(true))
1010
.arg(opt("registry", "Registry to use").value_name("REGISTRY"))
1111
.arg_new_opts()

src/bin/cargo/commands/owner.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use cargo::ops::{self, OwnersOptions};
55
pub fn cli() -> App {
66
subcommand("owner")
77
.about("Manage the owners of a crate on the registry")
8-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
8+
.arg_quiet()
99
.arg(Arg::with_name("crate"))
1010
.arg(
1111
multi_opt(

src/bin/cargo/commands/package.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use cargo::ops::{self, PackageOpts};
55
pub fn cli() -> App {
66
subcommand("package")
77
.about("Assemble the local package into a distributable tarball")
8-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
8+
.arg_quiet()
99
.arg(
1010
opt(
1111
"list",

src/bin/cargo/commands/pkgid.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use cargo::util::print_available_packages;
66
pub fn cli() -> App {
77
subcommand("pkgid")
88
.about("Print a fully qualified package specification")
9-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
9+
.arg_quiet()
1010
.arg(Arg::with_name("spec"))
1111
.arg_package("Argument to get the package ID specifier for")
1212
.arg_manifest_path()

src/bin/cargo/commands/publish.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use cargo::ops::{self, PublishOpts};
55
pub fn cli() -> App {
66
subcommand("publish")
77
.about("Upload a package to the registry")
8-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
8+
.arg_quiet()
99
.arg_index()
1010
.arg(opt("token", "Token to use when uploading").value_name("TOKEN"))
1111
.arg(opt(

src/bin/cargo/commands/read_manifest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Print a JSON representation of a Cargo.toml manifest.
99
Deprecated, use `cargo metadata --no-deps` instead.\
1010
",
1111
)
12-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
12+
.arg_quiet()
1313
.arg_manifest_path()
1414
}
1515

src/bin/cargo/commands/run.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn cli() -> App {
1010
// .alias("r")
1111
.setting(AppSettings::TrailingVarArg)
1212
.about("Run a binary or example of the local package")
13-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
13+
.arg_quiet()
1414
.arg(Arg::with_name("args").multiple(true))
1515
.arg_targets_bin_example(
1616
"Name of the bin target to run",

src/bin/cargo/commands/rustc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub fn cli() -> App {
99
subcommand("rustc")
1010
.setting(AppSettings::TrailingVarArg)
1111
.about("Compile a package, and pass extra options to the compiler")
12-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
12+
.arg_quiet()
1313
.arg(Arg::with_name("args").multiple(true).help("Rustc flags"))
1414
.arg_package("Package to build")
1515
.arg_jobs()

src/bin/cargo/commands/rustdoc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub fn cli() -> App {
66
subcommand("rustdoc")
77
.setting(AppSettings::TrailingVarArg)
88
.about("Build a package's documentation, using specified custom flags.")
9-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
9+
.arg_quiet()
1010
.arg(Arg::with_name("args").multiple(true))
1111
.arg(opt(
1212
"open",

src/bin/cargo/commands/search.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use cargo::ops;
77
pub fn cli() -> App {
88
subcommand("search")
99
.about("Search packages in crates.io")
10-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
10+
.arg_quiet()
1111
.arg(Arg::with_name("query").multiple(true))
1212
.arg_index()
1313
.arg(

src/bin/cargo/commands/tree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::str::FromStr;
1212
pub fn cli() -> App {
1313
subcommand("tree")
1414
.about("Display a tree visualization of a dependency graph")
15-
.arg(opt("quiet", "Suppress status messages").short("q"))
15+
.arg_quiet()
1616
.arg_manifest_path()
1717
.arg_package_spec_no_all(
1818
"Package to be used as the root of the tree",

src/bin/cargo/commands/uninstall.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use cargo::ops;
55
pub fn cli() -> App {
66
subcommand("uninstall")
77
.about("Remove a Rust binary")
8-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
8+
.arg_quiet()
99
.arg(Arg::with_name("spec").multiple(true))
1010
.arg_package_spec_simple("Package to uninstall")
1111
.arg(multi_opt("bin", "NAME", "Only uninstall the binary NAME"))

src/bin/cargo/commands/update.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use cargo::util::print_available_packages;
66
pub fn cli() -> App {
77
subcommand("update")
88
.about("Update dependencies as recorded in the local lock file")
9-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
9+
.arg_quiet()
1010
.arg(opt("workspace", "Only update the workspace packages").short("w"))
1111
.arg_package_spec_simple("Package to update")
1212
.arg(opt(

src/bin/cargo/commands/vendor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::path::PathBuf;
55
pub fn cli() -> App {
66
subcommand("vendor")
77
.about("Vendor all dependencies for a project locally")
8-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
8+
.arg_quiet()
99
.arg_manifest_path()
1010
.arg(Arg::with_name("path").help("Where to vendor crates (`vendor` by default)"))
1111
.arg(

src/bin/cargo/commands/verify_project.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::process;
66
pub fn cli() -> App {
77
subcommand("verify-project")
88
.about("Check correctness of crate manifest")
9-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
9+
.arg_quiet()
1010
.arg_manifest_path()
1111
.after_help("Run `cargo help verify-project` for more detailed information.\n")
1212
}

src/bin/cargo/commands/version.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::command_prelude::*;
44
pub fn cli() -> App {
55
subcommand("version")
66
.about("Show version information")
7-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
7+
.arg_quiet()
88
.after_help("Run `cargo help version` for more detailed information.\n")
99
}
1010

src/bin/cargo/commands/yank.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use cargo::ops;
55
pub fn cli() -> App {
66
subcommand("yank")
77
.about("Remove a pushed crate from the index")
8-
.arg(opt("quiet", "Do not print cargo log messages").short("q"))
8+
.arg_quiet()
99
.arg(Arg::with_name("crate"))
1010
.arg(
1111
opt("vers", "The version to yank or un-yank")

src/cargo/util/command_prelude.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,10 @@ pub trait AppExt: Sized {
236236
"Outputs a future incompatibility report at the end of the build",
237237
))
238238
}
239+
240+
fn arg_quiet(self) -> Self {
241+
self._arg(opt("quiet", "Do not print cargo log messages").short("q"))
242+
}
239243
}
240244

241245
impl AppExt for App {

0 commit comments

Comments
 (0)