diff options
author | Alexander Foremny <aforemny@posteo.de> | 2023-11-07 14:32:21 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2023-11-07 14:32:21 +0100 |
commit | 94eff8c0e6a9e8ff794cd95931cec606ab15f92a (patch) | |
tree | 19ac61aede0dc1238df4f7a20d9b8dac6ab5938e /app/Issue/GroupBy.hs | |
parent | 59ddbdb3d54de4009c2b3238661272f7e9fb80bc (diff) |
fix group-by parsing
Diffstat (limited to 'app/Issue/GroupBy.hs')
-rw-r--r-- | app/Issue/GroupBy.hs | 10 |
1 files 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 = |