🐙 Templated web page generator for your git repositories
git clone https://github.com/m-col/gitja
Files | Refs | Readme | License

Commit f134648414cc291f78794e65a281d77cb97141f5
Parent: d3d59757eb803a9675c94109fb7de9755221cfa3
Author: mcol <mcol@posteo.net>
Date: 2021-09-17 01:51:09 +0100
Committer: mcol <mcol@posteo.net>
Committed: 2021-09-17 01:51:09 +0100

Hook config up with per-repo processing function

src/Repositories.hs Modified

@@ -1,7 +1,7 @@
 {-# Language OverloadedStrings #-}  -- Needed for repository paths.
 
 module Repositories (
-    getLog
+    run
 ) where
 
 import Control.Monad.IO.Class (liftIO)
@@ -9,6 +9,9 @@
 import Git
 import Git.Libgit2 (lgFactory)
 
+import Config (Config, repoPaths)
+
+getLog :: FilePath -> IO ()
 getLog path = withRepository lgFactory path $ do
     maybeObjID <- resolveReference "HEAD"
     case maybeObjID of
@@ -16,3 +19,6 @@
             headCommit <- lookupCommit (Tagged commitID)
             liftIO $ print $ commitLog headCommit
         _ -> liftIO (print "Couldn't resolve HEAD")
+
+run :: Config -> IO ()
+run = mconcat . fmap getLog . repoPaths

src/Main.hs Modified

@@ -2,10 +2,7 @@
 module Main where
 
 import Config (getConfig)
-import Repositories
+import Repositories (run)
 
 main :: IO ()
-main = do
-    config <- getConfig "./config.dhall"
-    print config
-    getLog "."
+main = getConfig "./config.dhall" >>= run

src/Config.hs Modified

@@ -1,6 +1,8 @@
 {-# LANGUAGE DeriveGeneric #-}
 
 module Config (
+    Config,
+    repoPaths,
     getConfig
 ) where