diff --git a/cli/src/commands/operation/diff.rs b/cli/src/commands/operation/diff.rs index 461db2593..076ba457c 100644 --- a/cli/src/commands/operation/diff.rs +++ b/cli/src/commands/operation/diff.rs @@ -113,7 +113,8 @@ pub fn cmd_op_diff( let commit_summary_template = tx.commit_summary_template(); ui.request_pager(); - ui.stdout_formatter().with_label("op_log", |formatter| { + let mut formatter = ui.stdout_formatter(); + formatter.with_label("op_log", |formatter| { write!(formatter, "From operation ")?; write!( formatter.labeled("id"), @@ -152,6 +153,7 @@ pub fn cmd_op_diff( show_op_diff( ui, + formatter.as_mut(), tx.repo(), &from_repo, &to_repo, @@ -168,7 +170,8 @@ pub fn cmd_op_diff( /// into it. #[allow(clippy::too_many_arguments)] pub fn show_op_diff( - ui: &mut Ui, + ui: &Ui, + formatter: &mut dyn Formatter, current_repo: &dyn Repo, from_repo: &Arc, to_repo: &Arc, @@ -205,9 +208,6 @@ pub fn show_op_diff( |change_id: &ChangeId| change_parents.get(change_id).unwrap().clone(), ); - let mut formatter = ui.stdout_formatter(); - let formatter = formatter.as_mut(); - if !ordered_change_ids.is_empty() { writeln!(formatter)?; writeln!(formatter, "Changed commits:")?; diff --git a/cli/src/commands/operation/show.rs b/cli/src/commands/operation/show.rs index 70ca646f6..009344ffb 100644 --- a/cli/src/commands/operation/show.rs +++ b/cli/src/commands/operation/show.rs @@ -81,10 +81,12 @@ pub fn cmd_op_show( } ui.request_pager(); - template.format(&op, ui.stdout_formatter().as_mut())?; + let mut formatter = ui.stdout_formatter(); + template.format(&op, formatter.as_mut())?; show_op_diff( ui, + formatter.as_mut(), repo.as_ref(), &parent_repo, &repo,