From c81840e3b11fbe72b58fabed539bad140884ada6 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Tue, 7 Nov 2023 14:38:35 +0100 Subject: add numbers to grouped topics --- app/Issue/GroupBy.hs | 15 --------------- app/Main.hs | 21 +++++++++++++++------ 2 files changed, 15 insertions(+), 21 deletions(-) (limited to 'app') diff --git a/app/Issue/GroupBy.hs b/app/Issue/GroupBy.hs index 0754e68..62f212e 100644 --- a/app/Issue/GroupBy.hs +++ b/app/Issue/GroupBy.hs @@ -13,21 +13,6 @@ import Issue.Tag (Tag (..)) import Issue.Tag qualified as I import Options.Applicative qualified as O --- TODO Display number of issues within one group --- --- ``` --- Issue D --- Issue E --- --- @topic tags (2 issues) --- Issue A --- Issue B @topic ids --- --- @topic ids (2 issues) --- Issue B @topic tags --- Issue C --- ``` - -- TODO Add issues marker as internal tags -- -- The internal makers `TODO`, `FIXME`, etc. should be available via the diff --git a/app/Main.hs b/app/Main.hs index ee9e850..793d8a5 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -394,7 +394,7 @@ module Main where import Control.Applicative ((<|>)) import Data.Function ((&)) -import Data.List (find, isPrefixOf) +import Data.List (find, intersperse, isPrefixOf) import Data.Map qualified as M import Data.Maybe (catMaybes) import Data.Text qualified as T @@ -569,15 +569,24 @@ main = do let withinPath issue = if null files then True else any (\file -> file `isPrefixOf` issue.file) files ungroupedIssues <- applySorts sort . applyFilters filters . filter withinPath . fst <$> getHistory let groupedIssues = I.groupIssuesBy groupBy ungroupedIssues - putDoc colorize noPager width . P.vsep $ - map + putDoc colorize noPager width + . P.vsep + . intersperse ("" :: P.Doc ann) + $ map ( \(name, issues) -> P.vsep $ - P.hardline - : P.annotate (P.color P.Red) (P.pretty name) + ( P.annotate P.bold . P.annotate (P.color P.Yellow) $ + ( ( P.annotate P.bold $ + ("@topic" :: P.Doc ann) <+> P.pretty name + ) + <+> ("(" :: P.Doc ann) + <> P.pretty (length issues) + <> (")" :: P.Doc ann) + ) + ) : map ( \issue -> - P.indent 4 $ P.annotate P.bold $ P.pretty issue.title + P.indent 4 $ P.pretty issue.title ) issues ) -- cgit v1.2.3