Respect `--no-color` on the CLI (#16044)

## Summary

This argument has always existed for compatibility, but apparently we
don't respect it. I assume it was unintentionally dropped during a
refactor.

Closes https://github.com/astral-sh/uv/issues/15950.
This commit is contained in:
Charlie Marsh 2025-09-29 09:38:47 -04:00 committed by GitHub
parent 1d76c5a365
commit b2cc2c2749
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 0 deletions

View File

@ -89,6 +89,9 @@ impl GlobalSettings {
color: if let Some(color_choice) = args.color { color: if let Some(color_choice) = args.color {
// If `--color` is passed explicitly, use its value. // If `--color` is passed explicitly, use its value.
color_choice color_choice
} else if args.no_color {
// If `--no-color` is passed explicitly, disable color output.
ColorChoice::Never
} else if std::env::var_os(EnvVars::NO_COLOR) } else if std::env::var_os(EnvVars::NO_COLOR)
.filter(|v| !v.is_empty()) .filter(|v| !v.is_empty())
.is_some() .is_some()