From 9baae77533d861c8a8c14576c2ac168a242928c3 Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Sun, 14 Sep 2025 13:07:38 -0700 Subject: [PATCH] chore: update output_lines() to take a struct instead of a sequence of bools (#3591) I found the boolean literals hard to follow. --- codex-rs/tui/src/history_cell.rs | 33 +++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/codex-rs/tui/src/history_cell.rs b/codex-rs/tui/src/history_cell.rs index 31a91753..b2af5817 100644 --- a/codex-rs/tui/src/history_cell.rs +++ b/codex-rs/tui/src/history_cell.rs @@ -436,9 +436,16 @@ impl ExecCell { if let Some(output) = call.output.as_ref() && output.exit_code != 0 { - let out = output_lines(Some(output), false, false, false) - .into_iter() - .join("\n"); + let out = output_lines( + Some(output), + OutputLinesParams { + only_err: false, + include_angle_pipe: false, + include_prefix: false, + }, + ) + .into_iter() + .join("\n"); if !out.trim().is_empty() { // Wrap the output. for line in out.lines() { @@ -1178,9 +1185,11 @@ pub(crate) fn new_patch_apply_failure(stderr: String) -> PlainHistoryCell { stderr, formatted_output: String::new(), }), - true, - true, - true, + OutputLinesParams { + only_err: 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))] } -fn output_lines( - output: Option<&CommandOutput>, +struct OutputLinesParams { only_err: bool, include_angle_pipe: bool, include_prefix: bool, -) -> Vec> { +} + +fn output_lines(output: Option<&CommandOutput>, params: OutputLinesParams) -> Vec> { + let OutputLinesParams { + only_err, + include_angle_pipe, + include_prefix, + } = params; let CommandOutput { exit_code, stdout,