Skip to content

Commit a359ce1

Browse files
committed
Auto merge of #10152 - steven-joruk:quiet-config, r=ehuss
Support `term.quiet` configuration Fixes #10128 This follows the existing support for `--verbose` and `term.verbose`. I've renamed the related tests to be a bit clearer now there are more cases, and the existing quiet tests now prove that they hide the cargo log. I'm unsure whether I'm supposed to regenerate the documentation as part of this?
2 parents c689f55 + bfe27c5 commit a359ce1

File tree

96 files changed

+333
-80
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+333
-80
lines changed

src/cargo/util/config/mod.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -909,20 +909,19 @@ impl Config {
909909

910910
let color = color.or_else(|| term.color.as_deref());
911911

912-
let verbosity = match (verbose, term.verbose, quiet) {
913-
(true, _, false) | (_, Some(true), false) => Verbosity::Verbose,
914-
915-
// Command line takes precedence over configuration, so ignore the
916-
// configuration..
917-
(false, _, true) => Verbosity::Quiet,
918-
919-
// Can't pass both at the same time on the command line regardless
920-
// of configuration.
921-
(true, _, true) => {
922-
bail!("cannot set both --verbose and --quiet");
923-
}
924-
925-
(false, _, false) => Verbosity::Normal,
912+
// The command line takes precedence over configuration.
913+
let verbosity = match (verbose, quiet) {
914+
(true, true) => bail!("cannot set both --verbose and --quiet"),
915+
(true, false) => Verbosity::Verbose,
916+
(false, true) => Verbosity::Quiet,
917+
(false, false) => match (term.verbose, term.quiet) {
918+
(Some(true), Some(true)) => {
919+
bail!("cannot set both `term.verbose` and `term.quiet`")
920+
}
921+
(Some(true), Some(false)) => Verbosity::Verbose,
922+
(Some(false), Some(true)) => Verbosity::Quiet,
923+
_ => Verbosity::Normal,
924+
},
926925
};
927926

928927
let cli_target_dir = target_dir.as_ref().map(|dir| Filesystem::new(dir.clone()));
@@ -2127,6 +2126,7 @@ pub struct CargoBuildConfig {
21272126
#[derive(Deserialize, Default)]
21282127
struct TermConfig {
21292128
verbose: Option<bool>,
2129+
quiet: Option<bool>,
21302130
color: Option<String>,
21312131
#[serde(default)]
21322132
#[serde(deserialize_with = "progress_or_string")]

src/doc/man/generated_txt/cargo-bench.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,9 @@ OPTIONS
241241
value <https://doc.rust-lang.org/cargo/reference/config.html>.
242242

243243
-q, --quiet
244-
Do not print cargo log messages.
244+
Do not print cargo log messages. May also be specified with the
245+
term.quiet config value
246+
<https://doc.rust-lang.org/cargo/reference/config.html>.
245247

246248
--color when
247249
Control when colored output is used. Valid values:

src/doc/man/generated_txt/cargo-build.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,9 @@ OPTIONS
181181
value <https://doc.rust-lang.org/cargo/reference/config.html>.
182182

183183
-q, --quiet
184-
Do not print cargo log messages.
184+
Do not print cargo log messages. May also be specified with the
185+
term.quiet config value
186+
<https://doc.rust-lang.org/cargo/reference/config.html>.
185187

186188
--color when
187189
Control when colored output is used. Valid values:

src/doc/man/generated_txt/cargo-check.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ OPTIONS
185185
value <https://doc.rust-lang.org/cargo/reference/config.html>.
186186

187187
-q, --quiet
188-
Do not print cargo log messages.
188+
Do not print cargo log messages. May also be specified with the
189+
term.quiet config value
190+
<https://doc.rust-lang.org/cargo/reference/config.html>.
189191

190192
--color when
191193
Control when colored output is used. Valid values:

src/doc/man/generated_txt/cargo-clean.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ OPTIONS
6262
value <https://doc.rust-lang.org/cargo/reference/config.html>.
6363

6464
-q, --quiet
65-
Do not print cargo log messages.
65+
Do not print cargo log messages. May also be specified with the
66+
term.quiet config value
67+
<https://doc.rust-lang.org/cargo/reference/config.html>.
6668

6769
--color when
6870
Control when colored output is used. Valid values:

src/doc/man/generated_txt/cargo-doc.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ OPTIONS
156156
value <https://doc.rust-lang.org/cargo/reference/config.html>.
157157

158158
-q, --quiet
159-
Do not print cargo log messages.
159+
Do not print cargo log messages. May also be specified with the
160+
term.quiet config value
161+
<https://doc.rust-lang.org/cargo/reference/config.html>.
160162

161163
--color when
162164
Control when colored output is used. Valid values:

src/doc/man/generated_txt/cargo-fetch.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ OPTIONS
4747
value <https://doc.rust-lang.org/cargo/reference/config.html>.
4848

4949
-q, --quiet
50-
Do not print cargo log messages.
50+
Do not print cargo log messages. May also be specified with the
51+
term.quiet config value
52+
<https://doc.rust-lang.org/cargo/reference/config.html>.
5153

5254
--color when
5355
Control when colored output is used. Valid values:

src/doc/man/generated_txt/cargo-fix.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,9 @@ OPTIONS
258258
value <https://doc.rust-lang.org/cargo/reference/config.html>.
259259

260260
-q, --quiet
261-
Do not print cargo log messages.
261+
Do not print cargo log messages. May also be specified with the
262+
term.quiet config value
263+
<https://doc.rust-lang.org/cargo/reference/config.html>.
262264

263265
--color when
264266
Control when colored output is used. Valid values:

src/doc/man/generated_txt/cargo-generate-lockfile.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ OPTIONS
2323
value <https://doc.rust-lang.org/cargo/reference/config.html>.
2424

2525
-q, --quiet
26-
Do not print cargo log messages.
26+
Do not print cargo log messages. May also be specified with the
27+
term.quiet config value
28+
<https://doc.rust-lang.org/cargo/reference/config.html>.
2729

2830
--color when
2931
Control when colored output is used. Valid values:

src/doc/man/generated_txt/cargo-init.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ OPTIONS
6262
value <https://doc.rust-lang.org/cargo/reference/config.html>.
6363

6464
-q, --quiet
65-
Do not print cargo log messages.
65+
Do not print cargo log messages. May also be specified with the
66+
term.quiet config value
67+
<https://doc.rust-lang.org/cargo/reference/config.html>.
6668

6769
--color when
6870
Control when colored output is used. Valid values:

0 commit comments

Comments
 (0)