From 94eff8c0e6a9e8ff794cd95931cec606ab15f92a Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Tue, 7 Nov 2023 14:32:21 +0100 Subject: fix group-by parsing --- app/Issue/GroupBy.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Issue/GroupBy.hs b/app/Issue/GroupBy.hs index 0e8941f..0754e68 100644 --- a/app/Issue/GroupBy.hs +++ b/app/Issue/GroupBy.hs @@ -13,9 +13,6 @@ import Issue.Tag (Tag (..)) import Issue.Tag qualified as I import Options.Applicative qualified as O - --- FIXME Parse group by using @topic syntax - -- TODO Display number of issues within one group -- -- ``` @@ -41,12 +38,17 @@ import Options.Applicative qualified as O groupByArg :: O.Parser (Maybe T.Text) groupByArg = O.optional - ( O.strOption + ( O.option + (O.maybeReader (parse . T.pack)) ( O.long "group-by" <> O.metavar "TAG" <> O.help "Group selected issues." ) ) + where + parse s + | "@" `T.isPrefixOf` s = Just (T.drop 1 s) + | otherwise = Nothing groupIssuesBy :: T.Text -> [Issue] -> Map T.Text [Issue] groupIssuesBy groupBy issues = -- cgit v1.2.3