From ffc7e56a444423e7a924d0d52e060a4cf25208f0 Mon Sep 17 00:00:00 2001 From: Bloxx12 Date: Thu, 8 May 2025 09:44:03 +0200 Subject: [PATCH] print: clean up printing only show the actually changed versions, not all of them. make the changed bold --- src/print.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/print.rs b/src/print.rs index 77e8e7f..2ea7c06 100644 --- a/src/print.rs +++ b/src/print.rs @@ -19,12 +19,12 @@ fn diff_versions(left: &str, right: &str) -> (String, String) { post.push(l); } diff::Result::Left(l) => { - let string_to_push = format!("\x1b[31m{l}"); + let string_to_push = format!("\x1b[1;91m{l}"); prev.push_str(&string_to_push); } diff::Result::Right(r) => { - let string_to_push = format!("\x1b[32m{r}"); + let string_to_push = format!("\x1b[1;92m{r}"); post.push_str(&string_to_push); } } @@ -102,8 +102,8 @@ pub fn print_changes( changes.sort_by(|(a, _, _), (b, _, _)| a.cmp(b)); for (p, ver_pre, ver_post) in changes { - let mut version_vec_pre = ver_pre.iter().copied().collect::>(); - let mut version_vec_post = ver_post.iter().copied().collect::>(); + let mut version_vec_pre = ver_pre.difference(ver_post).copied().collect::>(); + let mut version_vec_post = ver_post.difference(ver_pre).copied().collect::>(); version_vec_pre.sort_unstable(); version_vec_post.sort_unstable(); @@ -129,7 +129,7 @@ pub fn print_changes( } println!( - "[{}] {:col_width$} {} ~> {}", + "[{}] {:col_width$} {} \u{00B1} {}", "C:".bold().bright_yellow(), p, diffed_pre,