mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Disable color for invalid commands with --color=never
This commit is contained in:
parent
8f5803e703
commit
fc8e41fbeb
1 changed files with 7 additions and 1 deletions
|
@ -2003,7 +2003,13 @@ where
|
|||
let cli = match Cli::try_parse_from(args) {
|
||||
Ok(cli) => cli,
|
||||
Err(mut err) => {
|
||||
let cmd = Cli::command().disable_colored_help(no_color);
|
||||
let cmd = if no_color {
|
||||
Cli::command()
|
||||
.color(clap::ColorChoice::Never)
|
||||
.disable_colored_help(true)
|
||||
} else {
|
||||
Cli::command()
|
||||
};
|
||||
err = err.with_cmd(&cmd);
|
||||
if let Some(ContextValue::String(subcommand)) = err.get(ContextKind::InvalidSubcommand)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue