{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
module Proof.Assistant.Version where

import Data.Text (Text)
import Data.Version
import Paths_proof_assistant_bot

import qualified Data.Text as Text

-- | Version of Rzk.
rzkVersion :: String
rzkVersion :: String
rzkVersion = VERSION_rzk

-- | Version of this package.
proofAssistantBotVersion :: String
proofAssistantBotVersion :: String
proofAssistantBotVersion = Version -> String
showVersion Version
version

-- | Helper to build version from template message.
makeVersion :: Text -> Text
makeVersion :: Text -> Text
makeVersion Text
txt = [Text] -> Text
Text.unlines
  [ Text -> Text -> Text -> Text
Text.replace Text
"<bot_version>" (String -> Text
Text.pack String
proofAssistantBotVersion) Text
txt
  , Text
"rzk v." Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> String -> Text
Text.pack String
rzkVersion
  ]