diff options
author | Fabian Kirchner <kirchner@posteo.de> | 2023-10-13 22:21:04 +0200 |
---|---|---|
committer | Fabian Kirchner <kirchner@posteo.de> | 2023-10-13 22:21:04 +0200 |
commit | 73f3b070e7f710bea00ad83f9714fba90a75974b (patch) | |
tree | 531e5ba055b436a6cf9b9554c05b7c4785423b3f /app/Main.hs | |
parent | 51663eab50cbc51a5786c0d55f21de62e9b15c0a (diff) |
show commit hash where issue occurs first
Diffstat (limited to 'app/Main.hs')
-rw-r--r-- | app/Main.hs | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/app/Main.hs b/app/Main.hs index 9e838c8..334f3ce 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -178,7 +178,8 @@ main = do ( \issue -> P.hsep ( concat - [ [P.annotate P.bold (P.pretty issue.title)], + [ [P.pretty issue.provenance.firstCommit, P.pretty (" " :: String)], + [P.annotate P.bold (P.pretty issue.title)], map ( \(I.Tag k v) -> P.annotate (P.colorDull P.Yellow) $ @@ -261,7 +262,7 @@ listIssues filters files = forgetGetIssuesExceptions _ = pure [] getIssues :: FilePath -> IO [Issue] -getIssues filename = +getIssues filename = do let extension = F.takeExtension filename treeGrepperLanguage = -- TODO Add support for all tree-grepper supported files @@ -285,20 +286,22 @@ getIssues filename = case A.eitherDecode raw of Left e -> throw (InvalidTreeGrepperResult e) Right treeGrepperResult -> treeGrepperResult - in catMaybes - . map (uncurry I.fromMatch) - . concatMap (\result -> map ((,) result) result.matches) - . map fixTreeGrepper - . decode - <$> sh - ( String.fromString - ( printf - "tree-grepper --query %s %s --format json %s" - (quote treeGrepperLanguage) - (quote treeGrepperQuery) - (quote filename) - ) - ) + + matches <- + concatMap (\result -> map ((,) result) result.matches) + . map fixTreeGrepper + . decode + <$> sh + ( String.fromString + ( printf + "tree-grepper --query %s %s --format json %s" + (quote treeGrepperLanguage) + (quote treeGrepperQuery) + (quote filename) + ) + ) + + catMaybes <$> mapM (uncurry I.fromMatch) matches fixTreeGrepper :: G.Result -> G.Result fixTreeGrepper treeGrepperResult = |