{-# LANGUAGE CPP #-}
module Data.Version.Extras
( gitAwareVersionInfo
) where
import Data.Version qualified as Data.Version
gitAwareVersionInfo
:: Data.Version.Version
-> String
gitAwareVersionInfo :: Version -> String
gitAwareVersionInfo Version
version = String
version' String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
gitRev String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
gitCommitDate
where
version' :: String
version' :: String
version' = Version -> String
Data.Version.showVersion Version
version
#ifdef __GIT_REV__
gitRev :: String
gitRev = " - git rev " <> __GIT_REV__
#else
gitRev :: String
gitRev :: String
gitRev = String
""
#endif
#ifdef __GIT_COMMIT_DATE__
gitCommitDate :: String
gitCommitDate = " - " <> __GIT_COMMIT_DATE__
#else
gitCommitDate :: String
gitCommitDate :: String
gitCommitDate = String
""
#endif