@@ -29,6 +29,8 @@ import qualified Data.Text.Lazy as L
2929import qualified Data.Text.Lazy.Encoding as L
3030import qualified Data.ByteString as B
3131
32+import Development.GitRev
33+
3234import Language.PureScript.AST.Literals
3335import Language.PureScript.CoreFn
3436import Language.PureScript.CoreFn.FromJSON
@@ -65,6 +67,11 @@ main = do
6567 B.writeFile "Makefile" $(embedFile "support/Makefile")
6668 when ("--help" `elem` opts') $
6769 putStrLn help
70+ when ("--version" `elem` opts') $ do
71+ let branch = $(gitBranch)
72+ details | branch == "master" = "master, commit: " ++ $(gitHash)
73+ | otherwise = branch
74+ putStrLn $ details ++ if $(gitDirty) then " (DIRTY)" else ""
6875 when (not $ null files) $ do
6976 let filepath = takeDirectory (head files)
7077 baseOutpath = joinPath $ (init $ splitDirectories filepath) ++ [outdir]
@@ -154,6 +161,7 @@ help = "Usage: pscpp OPTIONS COREFN-FILES\n\
154161 \ PureScript-to-C++ compiler\n\n\
155162 \Available options:\n\
156163 \ --help Show this help text\n\n\
164+ \ --version Show the version number\n\n\
157165 \ --makefile Generate a GNU Makefile which can be used for compiling\n\
158166 \ a PureScript program and libraries to a native binary via\n\
159167 \ purs corefn output and C++\n\n\