{-# LANGUAGE TemplateHaskell #-}

module Network.Mattermost.Version (mmApiVersion) where

import Data.Version (showVersion)
import Development.GitRev (gitBranch, gitHash)
import Paths_mattermost_api (version)

mmApiVersion :: String
mmApiVersion
  | $(gitHash) == ("UNKNOWN" :: String) = "mattermost-api " ++ showVersion version
  | otherwise = "mattermost-api " ++ showVersion version ++ " (" ++
                $(gitBranch) ++ "@" ++ $(gitHash) ++ ")"

{-# LANGUAGE TemplateHaskell #-}

module Network.Mattermost.Version (mmApiVersion) where

import Data.Version (showVersion)
import Development.GitRev (gitBranch, gitHash)
import Paths_mattermost_api (version)

mmApiVersion :: String
mmApiVersion
  | $(gitHash) == ("UNKNOWN" :: String) = "mattermost-api " ++ showVersion version
  | otherwise = "mattermost-api " ++ showVersion version ++ " (" ++
                $(gitBranch) ++ "@" ++ take 7 $(gitHash) ++ ")"

Truncate the git hash down to 7 characters
Truncate the git hash down to 7 characters
