@@ -22,6 +22,7 @@ pub struct GroupedReporterBuilder {
2222 workspace_path : Arc < AbsolutePath > ,
2323 writer : Box < dyn Write > ,
2424 color_support : ColorSupport ,
25+ silent : bool ,
2526}
2627
2728impl GroupedReporterBuilder {
@@ -30,12 +31,18 @@ impl GroupedReporterBuilder {
3031 /// `LeafExecutionReporter::start`) strip ANSI on the way into the buffer,
3132 /// so by the time the buffer reaches `writer` it already matches the
3233 /// terminal's colour capability. `writer` is therefore stored unwrapped.
34+ ///
35+ /// `silent` suppresses the runner's chrome — the labeled command line /
36+ /// cache indicator emitted in `LeafExecutionReporter::start` and the
37+ /// `── [pkg#task] ──` block header — leaving just the buffered task output;
38+ /// error banners are unaffected.
3339 pub fn new (
3440 workspace_path : Arc < AbsolutePath > ,
3541 writer : Box < dyn Write > ,
3642 color_support : ColorSupport ,
43+ silent : bool ,
3744 ) -> Self {
38- Self { workspace_path, writer, color_support }
45+ Self { workspace_path, writer, color_support, silent }
3946 }
4047}
4148
@@ -45,6 +52,7 @@ impl GraphExecutionReporterBuilder for GroupedReporterBuilder {
4552 writer : Rc :: new ( RefCell :: new ( self . writer ) ) ,
4653 workspace_path : self . workspace_path ,
4754 color_support : self . color_support ,
55+ silent : self . silent ,
4856 } )
4957 }
5058}
@@ -53,6 +61,7 @@ struct GroupedGraphReporter {
5361 writer : Rc < RefCell < Box < dyn Write > > > ,
5462 workspace_path : Arc < AbsolutePath > ,
5563 color_support : ColorSupport ,
64+ silent : bool ,
5665}
5766
5867impl GraphExecutionReporter for GroupedGraphReporter {
@@ -70,6 +79,7 @@ impl GraphExecutionReporter for GroupedGraphReporter {
7079 started : false ,
7180 grouped_buffer : None ,
7281 color_support : self . color_support ,
82+ silent : self . silent ,
7383 } )
7484 }
7585
@@ -88,20 +98,27 @@ struct GroupedLeafReporter {
8898 started : bool ,
8999 grouped_buffer : Option < Rc < RefCell < Vec < u8 > > > > ,
90100 color_support : ColorSupport ,
101+ silent : bool ,
91102}
92103
93104impl LeafExecutionReporter for GroupedLeafReporter {
94105 fn start ( & mut self , cache_status : CacheStatus ) -> StdioConfig {
95- let line =
96- format_command_with_cache_status ( & self . display , & self . workspace_path , & cache_status) ;
97-
98106 self . started = true ;
99107
100108 // Print labeled command line immediately (before output is buffered).
101- let labeled_line = vite_str:: format!( "{} {line}" , self . label) ;
102- let mut writer = self . writer . borrow_mut ( ) ;
103- let _ = writer. write_all ( labeled_line. as_bytes ( ) ) ;
104- let _ = writer. flush ( ) ;
109+ // `--silent` suppresses it; the buffered task output is still flushed
110+ // in `finish`.
111+ if !self . silent {
112+ let line = format_command_with_cache_status (
113+ & self . display ,
114+ & self . workspace_path ,
115+ & cache_status,
116+ ) ;
117+ let labeled_line = vite_str:: format!( "{} {line}" , self . label) ;
118+ let mut writer = self . writer . borrow_mut ( ) ;
119+ let _ = writer. write_all ( labeled_line. as_bytes ( ) ) ;
120+ let _ = writer. flush ( ) ;
121+ }
105122
106123 // Create shared buffer for both stdout and stderr.
107124 let buffer = Rc :: new ( RefCell :: new ( Vec :: new ( ) ) ) ;
@@ -128,23 +145,26 @@ impl LeafExecutionReporter for GroupedLeafReporter {
128145 _cache_update_status : CacheUpdateStatus ,
129146 error : Option < ExecutionError > ,
130147 ) {
131- // Build grouped block: header + buffered output.
148+ // Build grouped block: header + buffered output. `--silent` drops the
149+ // `── [pkg#task] ──` block header, leaving just the task's own output.
132150 let mut extra = Vec :: new ( ) ;
133151 if let Some ( ref grouped_buffer) = self . grouped_buffer {
134152 let content = grouped_buffer. borrow ( ) ;
135153 if !content. is_empty ( ) {
136- let header = vite_str:: format!(
137- "{} {} {}\n " ,
138- "──" . style( Style :: new( ) . bright_black( ) ) ,
139- self . label,
140- "──" . style( Style :: new( ) . bright_black( ) )
141- ) ;
142- extra. extend_from_slice ( header. as_bytes ( ) ) ;
154+ if !self . silent {
155+ let header = vite_str:: format!(
156+ "{} {} {}\n " ,
157+ "──" . style( Style :: new( ) . bright_black( ) ) ,
158+ self . label,
159+ "──" . style( Style :: new( ) . bright_black( ) )
160+ ) ;
161+ extra. extend_from_slice ( header. as_bytes ( ) ) ;
162+ }
143163 extra. extend_from_slice ( & content) ;
144164 }
145165 }
146166
147- write_leaf_trailing_output ( & self . writer , error, self . started , & extra) ;
167+ write_leaf_trailing_output ( & self . writer , error, self . started , self . silent , & extra) ;
148168 }
149169}
150170
@@ -177,6 +197,7 @@ mod tests {
177197 test_path ( ) ,
178198 Box :: new ( std:: io:: sink ( ) ) ,
179199 ColorSupport :: uniform ( false ) ,
200+ false ,
180201 ) ) ;
181202 let mut reporter = builder. build ( ) ;
182203 let mut leaf = reporter. new_leaf_execution ( & item. execution_item_display , leaf_kind ( item) ) ;
0 commit comments