Skip to content

Commit e873e4e

Browse files
committed
explicitly add --quiet option to all subcommands
1 parent 57d5048 commit e873e4e

30 files changed

Lines changed: 32 additions & 5 deletions

src/bin/cargo/cli.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ fn execute_subcommand(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
145145

146146
config.configure(
147147
args.occurrences_of("verbose") as u32,
148-
if args.is_present("quiet") {
148+
if args.is_present("quiet") || subcommand_args.is_present("quiet") {
149149
Some(true)
150150
} else {
151151
None
@@ -217,10 +217,7 @@ See 'cargo help <command>' for more information on a specific command.\n",
217217
.multiple(true)
218218
.global(true),
219219
)
220-
.arg(
221-
opt("quiet", "No output printed to stdout")
222-
.short("q")
223-
)
220+
.arg(opt("quiet", "No output printed to stdout").short("q"))
224221
.arg(
225222
opt("color", "Coloring: auto, always, never")
226223
.value_name("WHEN")
@@ -239,3 +236,4 @@ See 'cargo help <command>' for more information on a specific command.\n",
239236
)
240237
.subcommands(commands::builtin())
241238
}
239+

src/bin/cargo/commands/bench.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ pub fn cli() -> App {
66
subcommand("bench")
77
.setting(AppSettings::TrailingVarArg)
88
.about("Execute all benchmarks of a local package")
9+
.arg(opt("quiet", "No output printed to stdout").short("q"))
910
.arg(
1011
Arg::with_name("BENCHNAME")
1112
.help("If specified, only run benches containing this string in their names"),

src/bin/cargo/commands/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +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", "No output printed to stdout").short("q"))
1011
.arg_package_spec(
1112
"Package to build (see `cargo help pkgid`)",
1213
"Build all packages in the workspace",

src/bin/cargo/commands/check.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +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", "No output printed to stdout").short("q"))
1011
.arg_package_spec(
1112
"Package(s) to check",
1213
"Check all packages in the workspace",

src/bin/cargo/commands/clean.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use cargo::ops::{self, CleanOptions};
55
pub fn cli() -> App {
66
subcommand("clean")
77
.about("Remove artifacts that cargo has generated in the past")
8+
.arg(opt("quiet", "No output printed to stdout").short("q"))
89
.arg_package_spec_simple("Package to clean artifacts for")
910
.arg_manifest_path()
1011
.arg_target_triple("Target triple to clean output for")

src/bin/cargo/commands/doc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use cargo::ops::{self, DocOptions};
55
pub fn cli() -> App {
66
subcommand("doc")
77
.about("Build a package's documentation")
8+
.arg(opt("quiet", "No output printed to stdout").short("q"))
89
.arg(opt(
910
"open",
1011
"Opens the docs in a browser after the operation",

src/bin/cargo/commands/fetch.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +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", "No output printed to stdout").short("q"))
910
.arg_manifest_path()
1011
.arg_target_triple("Fetch dependencies for the target triple")
1112
.after_help(

src/bin/cargo/commands/fix.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use cargo::ops::{self, CompileFilter, FilterRule};
55
pub fn cli() -> App {
66
subcommand("fix")
77
.about("Automatically fix lint warnings reported by rustc")
8+
.arg(opt("quiet", "No output printed to stdout").short("q"))
89
.arg_package_spec(
910
"Package(s) to fix",
1011
"Fix all packages in the workspace",

src/bin/cargo/commands/generate_lockfile.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +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", "No output printed to stdout").short("q"))
89
.arg_manifest_path()
910
}
1011

src/bin/cargo/commands/git_checkout.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use cargo::util::ToUrl;
77
pub fn cli() -> App {
88
subcommand("git-checkout")
99
.about("Checkout a copy of a Git repository")
10+
.arg(opt("quiet", "No output printed to stdout").short("q"))
1011
.arg(
1112
Arg::with_name("url")
1213
.long("url")

0 commit comments

Comments
 (0)