From d8d6b367a7f594c0c211be472ca567a7a9a159d4 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Mon, 2 Sep 2024 21:17:46 -0700 Subject: [PATCH] Color groups in `--list` output (#2340) --- src/color.rs | 4 ++++ src/subcommand.rs | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/color.rs b/src/color.rs index f14a66207c..3c2969b8cc 100644 --- a/src/color.rs +++ b/src/color.rs @@ -73,6 +73,10 @@ impl Color { self.restyle(Style::new().fg(Red).bold()) } + pub(crate) fn group(self) -> Self { + self.restyle(Style::new().fg(Yellow).bold()) + } + pub(crate) fn warning(self) -> Self { self.restyle(Style::new().fg(Yellow).bold()) } diff --git a/src/subcommand.rs b/src/subcommand.rs index 449d4a0920..9e7486863d 100644 --- a/src/subcommand.rs +++ b/src/subcommand.rs @@ -575,7 +575,10 @@ impl Subcommand { if !no_groups { if let Some(group) = &group { - println!("{list_prefix}[{group}]"); + println!( + "{list_prefix}{}", + config.color.stdout().group().paint(&format!("[{group}]")) + ); } }