mirror of https://github.com/astral-sh/uv
Write an `Into<anstream::ColorChoice>` implementation for more idiomatic code (#1064)
Follow-up to #1049
This commit is contained in:
parent
1131341cbc
commit
1f0a21d127
|
|
@ -87,12 +87,12 @@ pub enum ColorChoice {
|
||||||
Never,
|
Never,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ColorChoice {
|
impl From<ColorChoice> for anstream::ColorChoice {
|
||||||
fn to_anstream(&self) -> anstream::ColorChoice {
|
fn from(value: ColorChoice) -> Self {
|
||||||
match self {
|
match value {
|
||||||
Self::Auto => anstream::ColorChoice::Auto,
|
ColorChoice::Auto => anstream::ColorChoice::Auto,
|
||||||
Self::Always => anstream::ColorChoice::Always,
|
ColorChoice::Always => anstream::ColorChoice::Always,
|
||||||
Self::Never => anstream::ColorChoice::Never,
|
ColorChoice::Never => anstream::ColorChoice::Never,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -599,7 +599,7 @@ async fn inner() -> Result<ExitStatus> {
|
||||||
if cli.no_color {
|
if cli.no_color {
|
||||||
anstream::ColorChoice::write_global(anstream::ColorChoice::Never);
|
anstream::ColorChoice::write_global(anstream::ColorChoice::Never);
|
||||||
} else {
|
} else {
|
||||||
anstream::ColorChoice::write_global(cli.color.to_anstream());
|
anstream::ColorChoice::write_global(cli.color.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
miette::set_hook(Box::new(|_| {
|
miette::set_hook(Box::new(|_| {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue