Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/uv-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ pub struct GlobalArgs {
conflicts_with = "no_color",
value_name = "COLOR_CHOICE"
)]
pub color: ColorChoice,
pub color: Option<ColorChoice>,

/// Whether to load TLS certificates from the platform's native certificate store.
///
Expand Down
14 changes: 9 additions & 5 deletions crates/uv/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,14 @@ impl GlobalSettings {
Self {
quiet: args.quiet,
verbose: args.verbose,
color: if args.no_color
|| std::env::var_os(EnvVars::NO_COLOR)
.filter(|v| !v.is_empty())
.is_some()
color: if let Some(color_choice) = args.color {
// If `--color` is passed explicitly, use its value.
color_choice
} else if std::env::var_os(EnvVars::NO_COLOR)
.filter(|v| !v.is_empty())
.is_some()
{
// If the `NO_COLOR` is set, disable color output.
ColorChoice::Never
} else if std::env::var_os(EnvVars::FORCE_COLOR)
.filter(|v| !v.is_empty())
Expand All @@ -87,9 +90,10 @@ impl GlobalSettings {
.filter(|v| !v.is_empty())
.is_some()
{
// If `FORCE_COLOR` or `CLICOLOR_FORCE` is set, always enable color output.
ColorChoice::Always
} else {
args.color
ColorChoice::Auto
},
native_tls: flag(args.native_tls, args.no_native_tls)
.combine(workspace.and_then(|workspace| workspace.globals.native_tls))
Expand Down
Loading