Add --no-color support for pip compatibility (#1048)

Adds `--no-color` as provided by `pip`.

See #1049 for follow-up.
This commit is contained in:
Zanie Blue
2024-01-22 22:56:51 -06:00
committed by GitHub
parent 81401a17e5
commit a87e071b5e
+8
View File
@@ -57,6 +57,10 @@ struct Cli {
#[arg(global = true, long, short, conflicts_with = "quiet")]
verbose: bool,
/// Disable colors.
#[arg(global = true, long)]
no_color: bool,
#[command(flatten)]
cache_args: CacheArgs,
}
@@ -552,6 +556,10 @@ async fn inner() -> Result<ExitStatus> {
puffin_warnings::enable();
}
if cli.no_color {
anstream::ColorChoice::write_global(anstream::ColorChoice::Never);
}
miette::set_hook(Box::new(|_| {
Box::new(
miette::MietteHandlerOpts::new()