summaryrefslogtreecommitdiff
path: root/main/Version.hs
diff options
context:
space:
mode:
Diffstat (limited to 'main/Version.hs')
-rw-r--r--main/Version.hs23
1 files changed, 23 insertions, 0 deletions
diff --git a/main/Version.hs b/main/Version.hs
new file mode 100644
index 0000000..71af694
--- /dev/null
+++ b/main/Version.hs
@@ -0,0 +1,23 @@
+{-# LANGUAGE TemplateHaskell #-}
+
+-- "Pattern match is redundant" warning can be generated based on template
+-- haskell $$tGitVersion value
+{-# OPTIONS_GHC -Wno-error=overlapping-patterns #-}
+
+module Version (
+ versionLine,
+) where
+
+import Paths_erebos (version)
+import Data.Version (showVersion)
+import Version.Git
+
+{-# NOINLINE versionLine #-}
+versionLine :: String
+versionLine = do
+ let ver = case $$tGitVersion of
+ Just gver
+ | 'v':v <- gver, not $ all (`elem` ('.': ['0'..'9'])) v
+ -> "git " <> gver
+ _ -> "version " <> showVersion version
+ in "Erebos CLI " <> ver