aboutsummaryrefslogtreecommitdiffstats
path: root/app/Issue/GroupBy.hs
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2023-11-09 15:43:28 +0100
committerLibravatar Alexander Foremny <aforemny@posteo.de>2023-11-09 15:47:28 +0100
commita37d3605e40b5c9c125568045e0fb99e9796fe49 (patch)
treed2a16285cd3724580e2db5f5d04b8f217b4ac873 /app/Issue/GroupBy.hs
parent12511580c732895e8c5d045e18803a766ed733b8 (diff)
group-by -> group
Diffstat (limited to 'app/Issue/GroupBy.hs')
-rw-r--r--app/Issue/GroupBy.hs45
1 files changed, 0 insertions, 45 deletions
diff --git a/app/Issue/GroupBy.hs b/app/Issue/GroupBy.hs
deleted file mode 100644
index 18859f2..0000000
--- a/app/Issue/GroupBy.hs
+++ /dev/null
@@ -1,45 +0,0 @@
-module Issue.GroupBy
- ( groupByArg,
- groupIssuesBy,
- )
-where
-
-import Data.Map (Map)
-import Data.Map qualified as M
-import Data.Maybe (mapMaybe)
-import Data.Text qualified as T
-import Issue (Issue (..))
-import Issue.Tag (Tag (..))
-import Issue.Tag qualified as I
-import Options.Applicative qualified as O
-
-groupByArg :: O.Parser (Maybe T.Text)
-groupByArg =
- O.optional
- ( 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 =
- foldl
- ( \collected issue ->
- foldl
- (flip $ M.alter (Just . maybe [issue] (issue :)))
- collected
- (groupsOfIssue groupBy issue)
- )
- M.empty
- issues
- where
- groupsOfIssue group issue =
- mapMaybe I.tagValue $
- filter (\(Tag key _) -> key == group) (issue.tags ++ issue.internalTags)