aboutsummaryrefslogtreecommitdiffstats
path: root/app/Issue.hs
diff options
context:
space:
mode:
Diffstat (limited to 'app/Issue.hs')
-rw-r--r--app/Issue.hs14
1 files changed, 12 insertions, 2 deletions
diff --git a/app/Issue.hs b/app/Issue.hs
index 07bddee..d163df7 100644
--- a/app/Issue.hs
+++ b/app/Issue.hs
@@ -3,17 +3,19 @@
{-# LANGUAGE OverloadedRecordDot #-}
{-# LANGUAGE OverloadedStrings #-}
-module Issue (Issue (..), fromMatch) where
+module Issue (Issue (..), fromMatch, id) where
+import Data.List (find)
import Data.Text (Text)
import Data.Text qualified as T
-import Issue.Tag (Tag)
+import Issue.Tag (Tag (..))
import Issue.Tag qualified as I
import Issue.Text qualified as I
import TreeGrepper.Match (Match (..))
import TreeGrepper.Match qualified as G
import TreeGrepper.Result (Result (..))
import TreeGrepper.Result qualified as G
+import Prelude hiding (id)
data Issue = Issue
{ title :: Text,
@@ -23,6 +25,14 @@ data Issue = Issue
tags :: [Tag],
internalTags :: [Tag]
}
+ deriving (Show)
+
+id :: Issue -> Maybe String
+id issue =
+ (\(Tag _ v) -> T.unpack v)
+ <$> ( find (\(Tag k _) -> k == "id") $
+ issue.tags ++ issue.internalTags
+ )
fromMatch :: G.Result -> G.Match -> Maybe Issue
fromMatch result match =