From 0ed3f76533cde17322cf04018713d70c2f78d490 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Wed, 14 Feb 2024 21:44:45 +0100 Subject: Version information from git Changelog: Added -V switch to show version --- main/Version.hs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 main/Version.hs (limited to 'main/Version.hs') 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 -- cgit v1.2.3