summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/App/CommandLineOptions.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc/App/CommandLineOptions.hs')
-rw-r--r--src/Text/Pandoc/App/CommandLineOptions.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs
index ffb7c5eb8..9328fff1f 100644
--- a/src/Text/Pandoc/App/CommandLineOptions.hs
+++ b/src/Text/Pandoc/App/CommandLineOptions.hs
@@ -5,6 +5,7 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TemplateHaskell #-}
{- |
Module : Text.Pandoc.App.CommandLineOptions
Copyright : Copyright (C) 2006-2022 John MacFarlane
@@ -70,6 +71,7 @@ import qualified Data.ByteString.Lazy as B
import qualified Data.Map as M
import qualified Data.Text as T
import qualified Text.Pandoc.UTF8 as UTF8
+import GitHash
parseOptions :: [OptDescr (Opt -> IO Opt)] -> Opt -> IO Opt
parseOptions options' defaults = do
@@ -952,9 +954,14 @@ options =
openlibs
getglobal "_VERSION"
peek top
+ let buildInfo = either
+ (\_ -> mempty)
+ (\gi -> "\nBuilt from commit " ++ giDescribe gi ++
+ " on " ++ giCommitDate gi)
+ $$tGitInfoCwdTry
UTF8.hPutStrLn stdout
$ T.pack
- $ prg ++ " " ++ T.unpack pandocVersion ++
+ $ prg ++ " " ++ T.unpack pandocVersion ++ buildInfo ++
compileInfo ++ "\nScripting engine: " ++ luaVersion ++
"\nUser data directory: " ++ defaultDatadir ++
('\n':copyrightMessage)