chore: update output_lines() to take a struct instead of a sequence of bools (#3591)

I found the boolean literals hard to follow.
This commit is contained in:
Michael Bolin
2025-09-14 13:07:38 -07:00
committed by GitHub
parent e932722292
commit 9baae77533

View File

@@ -436,9 +436,16 @@ impl ExecCell {
if let Some(output) = call.output.as_ref() if let Some(output) = call.output.as_ref()
&& output.exit_code != 0 && output.exit_code != 0
{ {
let out = output_lines(Some(output), false, false, false) let out = output_lines(
.into_iter() Some(output),
.join("\n"); OutputLinesParams {
only_err: false,
include_angle_pipe: false,
include_prefix: false,
},
)
.into_iter()
.join("\n");
if !out.trim().is_empty() { if !out.trim().is_empty() {
// Wrap the output. // Wrap the output.
for line in out.lines() { for line in out.lines() {
@@ -1178,9 +1185,11 @@ pub(crate) fn new_patch_apply_failure(stderr: String) -> PlainHistoryCell {
stderr, stderr,
formatted_output: String::new(), formatted_output: String::new(),
}), }),
true, OutputLinesParams {
true, only_err: true,
true, include_angle_pipe: true,
include_prefix: true,
},
)); ));
} }
@@ -1261,12 +1270,18 @@ pub(crate) fn new_reasoning_summary_block(
vec![Box::new(new_reasoning_block(full_reasoning_buffer, config))] vec![Box::new(new_reasoning_block(full_reasoning_buffer, config))]
} }
fn output_lines( struct OutputLinesParams {
output: Option<&CommandOutput>,
only_err: bool, only_err: bool,
include_angle_pipe: bool, include_angle_pipe: bool,
include_prefix: bool, include_prefix: bool,
) -> Vec<Line<'static>> { }
fn output_lines(output: Option<&CommandOutput>, params: OutputLinesParams) -> Vec<Line<'static>> {
let OutputLinesParams {
only_err,
include_angle_pipe,
include_prefix,
} = params;
let CommandOutput { let CommandOutput {
exit_code, exit_code,
stdout, stdout,