diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2024-02-14 21:44:45 +0100 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2024-02-14 21:46:21 +0100 |
commit | 0ed3f76533cde17322cf04018713d70c2f78d490 (patch) | |
tree | ee54fc7b27502ac0b9faf2ba54be13408aff7643 /main/Version.hs | |
parent | 8105c4ba4636c58b85f0235d2d1b53a0682b1a6a (diff) |
Version information from git
Changelog: Added -V switch to show version
Diffstat (limited to 'main/Version.hs')
-rw-r--r-- | main/Version.hs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/main/Version.hs b/main/Version.hs new file mode 100644 index 0000000..d7583bf --- /dev/null +++ b/main/Version.hs @@ -0,0 +1,19 @@ +{-# LANGUAGE TemplateHaskell #-} + +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 |