diff options
author | Alexander Foremny <aforemny@posteo.de> | 2023-11-09 15:48:21 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2023-11-09 15:48:21 +0100 |
commit | 2d47e950f2c66df89e5aec14d2be15f96e7c5716 (patch) | |
tree | 1fcfa2a4740e7c2f68ba2eccee8f5825f2b034a4 /app | |
parent | a37d3605e40b5c9c125568045e0fb99e9796fe49 (diff) |
improve grouped list styling
Diffstat (limited to 'app')
-rw-r--r-- | app/Main.hs | 50 |
1 files changed, 34 insertions, 16 deletions
diff --git a/app/Main.hs b/app/Main.hs index d6a263a..1016b77 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -586,30 +586,48 @@ main :: IO () main = do settings <- readSettings O.execParser (O.info (options <**> O.helper) O.idm) >>= \case - Options {colorize, noPager, width, command = List {sort, filters, files, group = Just group}} -> do + Options {internalTags, colorize, noPager, width, command = List {sort, filters, files, group = Just group}} -> 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 group ungroupedIssues putDoc colorize noPager width . P.vsep . intersperse ("" :: P.Doc ann) - $ map + $ concatMap ( \(name, issues) -> - P.vsep $ - ( P.annotate P.bold . P.annotate (P.color P.Yellow) $ - ( ( P.annotate P.bold $ - (("@" :: P.Doc ann) <> P.pretty group) <+> P.pretty name - ) - <+> ("(" :: P.Doc ann) - <> P.pretty (length issues) - <> (")" :: P.Doc ann) - ) - ) - : map - ( \issue -> - P.indent 4 $ P.pretty issue.title + ( P.annotate P.underlined $ + ( ( (("@" :: P.Doc ann) <> P.pretty group) <+> P.pretty name ) - issues + <+> ("(" :: P.Doc ann) + <> P.pretty (length issues) + <> (")" :: P.Doc ann) + ) + ) + : map + (P.indent 4) + ( map + ( \issue -> + let title = map (P.annotate P.bold . P.pretty) (T.words issue.title) + tags = prettyTags (issue.tags ++ if internalTags then issue.internalTags else []) + openedBy = + fromProvenance $ + P.annotate (P.color P.Black) . ("by" <+>) . P.pretty . (.first.author.name) + openedOn = + fromProvenance $ + P.annotate (P.color P.Black) . ("on" <+>) . P.pretty . show . utctDay . (.first.date) + fromProvenance = flip fmap issue.provenance + in P.nest 4 $ + P.fillSep + ( concat $ + [ title, + tags, + maybeToList openedOn, + maybeToList openedBy + ] + ) + ) + issues + ) ) (M.toList groupedIssues) Options {internalTags, colorize, noPager, width, command = List {sort, filters, files, group = Nothing}} -> do |