diff options
Diffstat (limited to 'app/Issue')
-rw-r--r-- | app/Issue/GroupBy.hs | 5 | ||||
-rw-r--r-- | app/Issue/Tag.hs | 19 |
2 files changed, 15 insertions, 9 deletions
diff --git a/app/Issue/GroupBy.hs b/app/Issue/GroupBy.hs index 2b9e514..18859f2 100644 --- a/app/Issue/GroupBy.hs +++ b/app/Issue/GroupBy.hs @@ -13,11 +13,6 @@ import Issue.Tag (Tag (..)) import Issue.Tag qualified as I import Options.Applicative qualified as O --- TODO Add issues marker as internal tags --- --- The internal makers `TODO`, `FIXME`, etc. should be available via the --- internal tag @type - groupByArg :: O.Parser (Maybe T.Text) groupByArg = O.optional diff --git a/app/Issue/Tag.hs b/app/Issue/Tag.hs index c2358a8..90c7520 100644 --- a/app/Issue/Tag.hs +++ b/app/Issue/Tag.hs @@ -4,11 +4,12 @@ module Issue.Tag internalTags, tagKey, tagValue, + tagValuesOf, ) where import Data.Binary (Binary) -import Data.Maybe (catMaybes) +import Data.Maybe (catMaybes, mapMaybe) import Data.Text (Text, pack) import Data.Text qualified as T import Data.Time.Clock (UTCTime (utctDay)) @@ -23,6 +24,15 @@ tagKey (Tag k _) = k tagValue :: Tag -> Maybe Text tagValue (Tag _ v) = v +tagValuesOf :: Text -> [Tag] -> [Text] +tagValuesOf key = + mapMaybe + ( \tag -> + if tagKey tag == key + then tagValue tag + else Nothing + ) + extractTags :: Text -> [Tag] extractTags = catMaybes @@ -38,8 +48,8 @@ extractTags = ) . T.lines -internalTags :: Text -> Maybe Provenance -> [Tag] -internalTags title provenance' = +internalTags :: Text -> Maybe Provenance -> [T.Text] -> [Tag] +internalTags title provenance' markers = concat [ [ Tag "id" $ Just $ toSpinalCase title ], @@ -52,7 +62,8 @@ internalTags title provenance' = Tag "editor" $ Just $ provenance.last.author.name ] ) - provenance' + provenance', + map (Tag "type" . Just) markers ] toSpinalCase :: Text -> Text |