Skip to content

Commit 8dc0f04

Browse files
epagecharmitro
authored andcommitted
fix(cli): Respect CARGO_TERM_COLOR in '--list' and '-Zhelp'
Found this with the test for `-Zhelp` in rust-lang#13461.
1 parent 125a6fc commit 8dc0f04

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/bin/cargo/cli.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,22 @@ pub fn main(gctx: &mut GlobalContext) -> CliResult {
5555
.map(String::as_str)
5656
== Some("help")
5757
{
58+
// Don't let config errors get in the way of parsing arguments
59+
let _ = config_configure(gctx, &expanded_args, None, global_args, None);
5860
print_zhelp(gctx);
5961
} else if expanded_args.flag("version") {
62+
// Don't let config errors get in the way of parsing arguments
63+
let _ = config_configure(gctx, &expanded_args, None, global_args, None);
6064
let version = get_version_string(is_verbose);
6165
drop_print!(gctx, "{}", version);
6266
} else if let Some(code) = expanded_args.get_one::<String>("explain") {
67+
// Don't let config errors get in the way of parsing arguments
68+
let _ = config_configure(gctx, &expanded_args, None, global_args, None);
6369
let mut procss = gctx.load_global_rustc(None)?.process();
6470
procss.arg("--explain").arg(code).exec()?;
6571
} else if expanded_args.flag("list") {
72+
// Don't let config errors get in the way of parsing arguments
73+
let _ = config_configure(gctx, &expanded_args, None, global_args, None);
6674
print_list(gctx, is_verbose);
6775
} else {
6876
let (cmd, subcommand_args) = match expanded_args.subcommand() {

0 commit comments

Comments
 (0)