From 618005bf109c96893723ca12655fde38525780a0 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Mon, 16 Oct 2023 13:25:07 +0200 Subject: add `--sort` to `list` --- app/History.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'app/History.hs') 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 = -- cgit v1.2.3