summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2022-04-11 17:17:11 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2022-04-11 17:17:11 -0700
commitf81f5a20900ca9d8ad9971b6f57c11281ab2b048 (patch)
tree9acdf8770caed557f6ee966a65ea7e17365e7cd1 /src
parent0ddddf2f37e97ae9ef67150f934eff9ea4700a95 (diff)
Add 'nightly' flag and build with this for nightlies.
This flag causes a suffix '-nightly-YYYY-MM-DD' to be added to the version for nightlies. Closes #8016.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/App/CommandLineOptions.hs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs
index ffb7c5eb8..797a73725 100644
--- a/src/Text/Pandoc/App/CommandLineOptions.hs
+++ b/src/Text/Pandoc/App/CommandLineOptions.hs
@@ -56,6 +56,8 @@ import Text.Pandoc.Filter (Filter (..))
import Text.Pandoc.Highlighting (highlightingStyles)
import Text.Pandoc.Shared (ordNub, elemText, safeStrRead, defaultUserDataDir)
import Text.Printf
+import Data.Time.Clock (UTCTime(utctDay), getCurrentTime)
+import Data.Time.Format (defaultTimeLocale, iso8601DateFormat, formatTime)
#ifdef EMBED_DATA_FILES
import Text.Pandoc.Data (dataFiles)
@@ -952,9 +954,20 @@ options =
openlibs
getglobal "_VERSION"
peek top
+ versionSuffix <-
+#ifdef NIGHTLY
+ ("-nightly-" ++)
+ . formatTime defaultTimeLocale
+ (iso8601DateFormat Nothing)
+ . utctDay
+ <$> Data.Time.Clock.getCurrentTime
+#else
+ pure ""
+#endif
UTF8.hPutStrLn stdout
$ T.pack
- $ prg ++ " " ++ T.unpack pandocVersion ++
+ $ prg ++ " " ++
+ T.unpack pandocVersion ++ versionSuffix ++
compileInfo ++ "\nScripting engine: " ++ luaVersion ++
"\nUser data directory: " ++ defaultDatadir ++
('\n':copyrightMessage)