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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user