@@ -11,10 +11,10 @@ use std::{
1111} ;
1212
1313use anstream:: ColorChoice ;
14- use anstyle:: { AnsiColor , Style } ;
14+ use anstyle:: Style ;
1515use anyhow:: { Context , Error , Result , anyhow} ;
1616use clap:: { Args , CommandFactory , Parser , Subcommand , ValueEnum , builder:: PossibleValue } ;
17- use clap_cargo:: style:: { CONTEXT , HEADER } ;
17+ use clap_cargo:: style:: { CONTEXT , ERROR , GOOD , HEADER , WARN } ;
1818use clap_complete:: Shell ;
1919use futures_util:: stream:: StreamExt ;
2020use indicatif:: { MultiProgress , ProgressBar , ProgressStyle } ;
@@ -825,23 +825,11 @@ async fn check_updates(cfg: &Cfg<'_>, opts: CheckOpts) -> Result<ExitCode> {
825825 Style :: new ( )
826826 } ;
827827
828- let error = if use_colors {
829- AnsiColor :: Red . on_default ( ) . bold ( )
830- } else {
831- Style :: new ( )
832- } ;
828+ let error = if use_colors { ERROR } else { Style :: new ( ) } ;
833829
834- let good = if use_colors {
835- AnsiColor :: Green . on_default ( ) . bold ( )
836- } else {
837- Style :: new ( )
838- } ;
830+ let good = if use_colors { GOOD } else { Style :: new ( ) } ;
839831
840- let warn = if use_colors {
841- AnsiColor :: Yellow . on_default ( ) . bold ( )
842- } else {
843- Style :: new ( )
844- } ;
832+ let warn = if use_colors { WARN } else { Style :: new ( ) } ;
845833
846834 // Ensure that `.buffered()` is never called with 0 as this will cause a hang.
847835 // See: https://github.com/rust-lang/futures-rs/pull/1194#discussion_r209501774
@@ -852,7 +840,7 @@ async fn check_updates(cfg: &Cfg<'_>, opts: CheckOpts) -> Result<ExitCode> {
852840 let channels = tokio_stream:: iter ( channels. into_iter ( ) ) . map ( |( name, distributable) | {
853841 let msg = format ! ( "{bold}{name} - {bold:#}" ) ;
854842 let status = "Checking..." ;
855- let template = format ! ( "{{msg}}{status} {{ spinner:.green} }" ) ;
843+ let template = format ! ( "{{msg}}{status} {good}{{ spinner}}{good:# }" ) ;
856844 let pb = multi_progress_bars. add ( ProgressBar :: new ( 1 ) ) ;
857845 pb. set_style (
858846 ProgressStyle :: with_template ( template. as_str ( ) )
0 commit comments