From 4830a4f161e33cbb7e63ad66297dfc5e08649ea1 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 21 Feb 2024 21:24:01 -0600 Subject: [PATCH] fix(cli): Respect CARGO_TERM_COLOR in '--list' and '-Zhelp' Found this with the test for `-Zhelp` in #13461. --- src/bin/cargo/cli.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bin/cargo/cli.rs b/src/bin/cargo/cli.rs index b73567bff5fe..69a7cf91493c 100644 --- a/src/bin/cargo/cli.rs +++ b/src/bin/cargo/cli.rs @@ -55,14 +55,18 @@ pub fn main(gctx: &mut GlobalContext) -> CliResult { .map(String::as_str) == Some("help") { + config_configure(gctx, &expanded_args, None, global_args, None)?; print_zhelp(gctx); } else if expanded_args.flag("version") { + config_configure(gctx, &expanded_args, None, global_args, None)?; let version = get_version_string(is_verbose); drop_print!(gctx, "{}", version); } else if let Some(code) = expanded_args.get_one::("explain") { + config_configure(gctx, &expanded_args, None, global_args, None)?; let mut procss = gctx.load_global_rustc(None)?.process(); procss.arg("--explain").arg(code).exec()?; } else if expanded_args.flag("list") { + config_configure(gctx, &expanded_args, None, global_args, None)?; print_list(gctx, is_verbose); } else { let (cmd, subcommand_args) = match expanded_args.subcommand() {