11use clap:: Parser ;
22use dotenvy:: dotenv;
3- use indicatif :: ProgressStyle ;
3+ use stackable_cockpit :: PROGRESS_SPINNER_STYLE ;
44use stackablectl:: cli:: { Cli , Error } ;
55use tracing:: { Level , metadata:: LevelFilter } ;
6- use tracing_indicatif:: { IndicatifLayer , indicatif_eprintln} ;
7- use tracing_subscriber:: { fmt, layer:: SubscriberExt , util:: SubscriberInitExt } ;
6+ use tracing_indicatif:: {
7+ IndicatifLayer ,
8+ filter:: { IndicatifFilter , hide_indicatif_span_fields} ,
9+ indicatif_eprintln,
10+ } ;
11+ use tracing_subscriber:: {
12+ Layer as _,
13+ fmt:: { self , format:: DefaultFields } ,
14+ layer:: SubscriberExt ,
15+ util:: SubscriberInitExt ,
16+ } ;
817
918#[ snafu:: report]
1019#[ tokio:: main]
@@ -19,16 +28,12 @@ async fn main() -> Result<(), Error> {
1928 . with_target ( false ) ;
2029
2130 let indicatif_layer = IndicatifLayer :: new ( )
22- . with_progress_style ( ProgressStyle :: with_template ( "" ) . expect ( "valid progress template" ) )
23- . with_max_progress_bars (
24- 15 ,
25- Some (
26- ProgressStyle :: with_template (
27- "...and {pending_progress_bars} more processes not shown above." ,
28- )
29- . expect ( "valid progress template" ) ,
30- ) ,
31- ) ;
31+ . with_span_field_formatter (
32+ // If the `{span_fields}` interpolation is used in a template, then we want to hide the
33+ // indicatif control fields "indicatif.pb_show" and "indicatif.pb_hide"
34+ hide_indicatif_span_fields ( DefaultFields :: new ( ) ) ,
35+ )
36+ . with_progress_style ( PROGRESS_SPINNER_STYLE . clone ( ) ) ;
3237
3338 if let Some ( level) = app. log_level {
3439 tracing_subscriber:: registry ( )
@@ -43,7 +48,7 @@ async fn main() -> Result<(), Error> {
4348 } else {
4449 tracing_subscriber:: registry ( )
4550 . with ( LevelFilter :: from_level ( Level :: INFO ) )
46- . with ( indicatif_layer)
51+ . with ( indicatif_layer. with_filter ( IndicatifFilter :: new ( false ) ) )
4752 . init ( ) ;
4853 }
4954
0 commit comments