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

Commit 62ca2ef70d9b8ad797268b5ad7016faec06759ef
Parent: cdd0f330e131cf58d77428586dfa9d8c9750ea0d
Author: mcol <mcol@posteo.net>
Date: 2021-11-21 00:35:56 +0000
Committer: mcol <mcol@posteo.net>
Committed: 2021-11-21 00:35:56 +0000

Import version data provided by cabal

src/Main.hs Modified

@@ -4,7 +4,10 @@
     main
 ) where
 
+import Paths_gitserve (version)
+
 import Data.Text (Text)
+import Data.Version (showVersion)
 import qualified Options.Applicative as O
 
 import Config (getConfig)
@@ -18,7 +21,7 @@
 data Options = Options
     { config :: Text
     , force :: Bool
-    , version :: Bool
+    , printVersion :: Bool
     }
 
 opts :: O.Parser Options
@@ -52,14 +55,11 @@
 main :: IO ()
 main = do
     options <- parser
-    if version options
+    if printVersion options
         then
-            putStrLn $ "Your gitserve version is: " <> currentVersion
+            putStrLn $ "Your gitserve version is: " <> showVersion version
         else do
             conf <- getConfig (config options)
             env <- loadTemplates (force options) conf
             repos <- runIndex env
             run env repos
-
-currentVersion :: String
-currentVersion = "0.1.0"

gitserve.cabal Modified

@@ -16,7 +16,7 @@
 executable gitserve
   hs-source-dirs:      src
   main-is:             Main.hs
-  other-modules:       Config, Index, Repositories, Templates, Types
+  other-modules:       Config, Index, Repositories, Templates, Types, Paths_gitserve
   default-language:    Haskell2010
   build-depends:       base >= 4.7 && < 5
                      , conduit