aboutsummaryrefslogtreecommitdiffstats
path: root/app/History.hs
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2023-10-16 13:25:07 +0200
committerLibravatar Alexander Foremny <aforemny@posteo.de>2023-10-16 14:04:08 +0200
commit618005bf109c96893723ca12655fde38525780a0 (patch)
tree98aae5a552c8c382550c4dbe9438652d23c6e141 /app/History.hs
parent162577ddab4b440f97509f3076c6cd8ff2371059 (diff)
add `--sort` to `list`
Diffstat (limited to 'app/History.hs')
-rw-r--r--app/History.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/app/History.hs b/app/History.hs
index 8fdbd0a..ff7f889 100644
--- a/app/History.hs
+++ b/app/History.hs
@@ -13,6 +13,7 @@ import GHC.Generics (Generic)
import Issue (Issue (..), fromMatch, id)
import Issue.Filter (Filter, applyFilter)
import Issue.Tag qualified as I
+import Issue.Sort (Sort, applySort)
import Parallel (parMapM)
import Process (proc, sh, sh_)
import System.Directory (createDirectoryIfMissing, doesFileExist, getCurrentDirectory)
@@ -26,8 +27,8 @@ import TreeGrepper.Result qualified as G
import Prelude hiding (id, lines)
import Prelude qualified as Prelude
-listIssues :: [Filter] -> [FilePath] -> IO [Issue]
-listIssues filters paths = do
+listIssues :: [Sort] -> [Filter] -> [FilePath] -> IO [Issue]
+listIssues sort filters paths = do
commitHashes <- fmap reverse getCommitHashes
case commitHashes of
[] ->
@@ -53,12 +54,13 @@ listIssues filters paths = do
let eventses = getEvents hashFirst issuesInitial (commitInfos ++ [commitInfoWorkingTree])
let issues = mapMaybe issueFromIssueEvents eventses
issuesFiltered = filter (applyFilter filters) issues
+ issuesSorted = applySort sort issuesFiltered
issuesWithinPaths =
case paths of
[] ->
- issuesFiltered
+ issuesSorted
_ ->
- filter withinPaths issuesFiltered
+ filter withinPaths issuesSorted
pure issuesWithinPaths
where
withinPaths issue =