aboutsummaryrefslogtreecommitdiffstats
path: root/app/Issue.hs
diff options
context:
space:
mode:
Diffstat (limited to 'app/Issue.hs')
-rw-r--r--app/Issue.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/app/Issue.hs b/app/Issue.hs
index 411e910..73122ef 100644
--- a/app/Issue.hs
+++ b/app/Issue.hs
@@ -16,6 +16,7 @@ import GHC.Generics (Generic)
import GHC.Records (HasField (..))
import Issue.Provenance (Author (..), Commit (..), Provenance (..))
import Issue.Tag (Tag (..))
+import TreeGrepper.Comment qualified as G
import TreeGrepper.Match qualified as G
import Prelude hiding (id)
@@ -28,7 +29,8 @@ data Issue = Issue
end :: G.Position,
tags :: [Tag],
markers :: [T.Text],
- rawText :: T.Text
+ rawText :: T.Text,
+ commentStyle :: G.CommentStyle
}
deriving (Show, Binary, Generic, Eq)
@@ -58,13 +60,10 @@ toSpinalCase = T.replace " " "-" . T.filter keep . T.toLower
where
keep = (`elem` (concat [[' ', '-'], ['a' .. 'z'], ['0' .. '9']]))
--- TODO `replaceFile` hardcodes comment
---
--- @difficulty easy
replaceText :: Issue -> T.Text -> IO ()
replaceText issue s' = T.writeFile issue.file . replace (indent (comment s')) =<< T.readFile issue.file
where
- comment = T.intercalate "\n" . map T.strip . map ("-- " <>) . T.lines
+ comment = T.intercalate "\n" . map T.strip . T.lines . G.comment issue.commentStyle
indent = T.intercalate "\n" . mapButFirst (T.replicate (issue.start.column - 1) " " <>) . T.lines
replace s t = before <> s <> after
where