From ed6573c56785bf0b31b0e93ca5c9e32c0d75a56f Mon Sep 17 00:00:00 2001 From: faukah Date: Fri, 9 Oct 2026 15:16:51 +0200 Subject: [PATCH] render: add a count to the diff headings --- CHANGELOG.md | 2 ++ crates/dix/src/render.rs | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5253a2d..4c853f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ This is a changelog of the `dix` repository. It follows the ### Added +- The `CHANGED`, `ADDED` and `REMOVED` headings now show how many packages + they contain, e.g. `CHANGED (12)`. - Added the `dix last [N]` subcommand, which shows the changes leading up to the current profile generation, `dix last --all` for every generation, and `dix last --from A --to B` for the generations numbered A to B. diff --git a/crates/dix/src/render.rs b/crates/dix/src/render.rs index df3958e..2de3ec1 100644 --- a/crates/dix/src/render.rs +++ b/crates/dix/src/render.rs @@ -98,8 +98,13 @@ fn render_diffs( StatusGroup::Removed => "REMOVED", } .bold(); + let count = diffs + .iter() + .filter(|other| status_group(other.status) == group) + .count(); + let count = format!("({count})"); - writeln!(writer, "{header}")?; + writeln!(writer, "{header} {count}", count = count.dim())?; last_status_group = Some(group); }