1
1
use clap:: Parser ;
2
2
use dotenvy:: dotenv;
3
- use indicatif :: ProgressStyle ;
3
+ use stackable_cockpit :: PROGRESS_SPINNER_STYLE ;
4
4
use stackablectl:: cli:: { Cli , Error } ;
5
5
use 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
+ } ;
8
17
9
18
#[ snafu:: report]
10
19
#[ tokio:: main]
@@ -19,16 +28,12 @@ async fn main() -> Result<(), Error> {
19
28
. with_target ( false ) ;
20
29
21
30
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 ( ) ) ;
32
37
33
38
if let Some ( level) = app. log_level {
34
39
tracing_subscriber:: registry ( )
@@ -43,7 +48,7 @@ async fn main() -> Result<(), Error> {
43
48
} else {
44
49
tracing_subscriber:: registry ( )
45
50
. with ( LevelFilter :: from_level ( Level :: INFO ) )
46
- . with ( indicatif_layer)
51
+ . with ( indicatif_layer. with_filter ( IndicatifFilter :: new ( false ) ) )
47
52
. init ( ) ;
48
53
}
49
54
0 commit comments