diff options
author | stuebinm | 2021-12-22 21:45:45 +0100 |
---|---|---|
committer | stuebinm | 2021-12-22 21:45:45 +0100 |
commit | ebfc8be95e83852081d8dc93d2bf4717df18583e (patch) | |
tree | d7a70d354046e9d6d4dc8ec0fd73bc46e60c3b40 /src/Version.hs | |
parent | e8fca76246a313f743180408c5745cb050d1d1a6 (diff) |
print version information on --version
If --version is given, `walint` prints version information, then exists
with code 0.
Diffstat (limited to 'src/Version.hs')
-rw-r--r-- | src/Version.hs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Version.hs b/src/Version.hs new file mode 100644 index 0000000..6679ae1 --- /dev/null +++ b/src/Version.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE TemplateHaskell #-} + + +module Version ( version ) where + +import Control.Monad.Trans (liftIO) +import qualified Language.Haskell.TH as TH +import System.Process (readProcess) + +version :: String +version = "walint rc3 2021 (" <> + $(do + hash <- liftIO $ readProcess "git" ["rev-parse", "HEAD"] "" + pure . TH.LitE . TH.StringL $ take 40 hash) ++ + ")" |