summaryrefslogtreecommitdiff
path: root/walint-cli/Version.hs
diff options
context:
space:
mode:
Diffstat (limited to 'walint-cli/Version.hs')
-rw-r--r--walint-cli/Version.hs17
1 files changed, 17 insertions, 0 deletions
diff --git a/walint-cli/Version.hs b/walint-cli/Version.hs
new file mode 100644
index 0000000..1748512
--- /dev/null
+++ b/walint-cli/Version.hs
@@ -0,0 +1,17 @@
+{-# LANGUAGE TemplateHaskell #-}
+
+
+module Version ( version ) where
+
+import Universum
+
+import qualified Language.Haskell.TH as TH
+import System.Process (readProcess)
+
+version :: String
+version = "walint generic 2022 (" <>
+ $(do
+ hash <- liftIO $ catchAny (readProcess "git" ["rev-parse", "HEAD"] "")
+ (\_ -> pure "[unknown]")
+ pure . TH.LitE . TH.StringL $ take 40 hash) ++
+ ")"