aboutsummaryrefslogtreecommitdiffstats
path: root/app/Main.hs
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2023-12-13 04:35:19 +0100
committerLibravatar Alexander Foremny <aforemny@posteo.de>2023-12-13 04:50:01 +0100
commitb98ef2f84195b515b3b00c593249ed418de38814 (patch)
tree71f5402906a3157676f2347947b4b87996cb0965 /app/Main.hs
parent2bbd2f8b692dd952903a9f1527f2779a916118ab (diff)
chore: compute issues and issue events separately
Diffstat (limited to 'app/Main.hs')
-rw-r--r--app/Main.hs15
1 files changed, 7 insertions, 8 deletions
diff --git a/app/Main.hs b/app/Main.hs
index 603ab2a..1b06a0d 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -363,7 +363,6 @@ import Data.Text.IO qualified as T
import Data.Text.Lazy qualified as LT
import Data.Text.Lazy.IO qualified as LT
import Git qualified
-import History (History (..), getHistory)
import History qualified as H
import Issue (Issue (..))
import Issue qualified as I
@@ -534,7 +533,7 @@ idArg =
<> O.completer
( O.listIOCompleter $
map T.unpack . M.keys . (.issues)
- <$> getHistory
+ <$> H.getIssues
)
)
@@ -569,7 +568,7 @@ main = do
. I.applyPath files
. I.applyClosed closed
. (M.elems . (.issues))
- <$> getHistory
+ <$> H.getIssues
let groupedIssues = I.groupIssuesByTag group ungroupedIssues
putDoc colorize noPager width (group, groupedIssues)
Options {colorize, noPager, width, command = List {sort, filters, files, group = Nothing, closed, detailed, edit}} -> do
@@ -579,20 +578,20 @@ main = do
. I.applyPath files
. I.applyClosed closed
. (M.elems . (.issues))
- <$> getHistory
+ <$> H.getIssues
if edit
then editIssues issues
else
putDoc colorize noPager width . (P.vsep . intersperse "") $
map (if detailed then (P.render . P.Detailed) else (P.render . P.Summarized)) issues
Options {colorize, noPager, width, command = Log {patch}} -> do
- es <- reverse . (.issueEvents) <$> getHistory
+ es <- reverse . (.issueEvents) <$> H.getIssueEvents
putDoc colorize noPager width $
if patch
then P.vsep . intersperse P.emptyDoc $ map (P.render . P.Detailed) es
else P.vsep $ map (P.render . P.Summarized) es
Options {colorize, noPager, width, command = Show {id, edit}} -> do
- issues <- (.issues) <$> getHistory
+ issues <- (.issues) <$> H.getIssues
issue <-
case M.lookup (T.pack id) issues of
Nothing -> die (printf "no issue with id `%s'\n" id)
@@ -601,7 +600,7 @@ main = do
then editIssues [issue]
else putDoc colorize noPager width $ showIssue (M.elems issues) issue
Options {colorize, noPager, width, internalTags, command = Tags} -> do
- issues <- (.issues) <$> getHistory
+ issues <- (.issues) <$> H.getIssues
let tags =
concatMap
( \issue ->
@@ -637,7 +636,7 @@ editIssues issues = withSystemTempDirectory "anissue-edit" (go issues)
I.replaceText issue =<< T.readFile (fp issue)
replaceTexts (issue : issues) = do
I.replaceText issue =<< T.readFile (fp issue)
- issues' <- H.getIssues Git.WorkingTree issue.file
+ issues' <- H.getIssuesOfFile Git.WorkingTree issue.file
replaceTexts [fromMaybe issue (find ((==) issue.id . (.id)) issues') | issue <- issues]
putDoc :: P.Render a => Color -> Bool -> Maybe Int -> a -> IO ()