aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Haddock/Options.hs5
-rw-r--r--src/Main.hs8
2 files changed, 10 insertions, 3 deletions
diff --git a/src/Haddock/Options.hs b/src/Haddock/Options.hs
index bfc8ae27..9770f37d 100644
--- a/src/Haddock/Options.hs
+++ b/src/Haddock/Options.hs
@@ -84,6 +84,7 @@ data Flag
| Flag_UsePackage String
| Flag_OptGhc String
| Flag_GhcLibDir String
+ | Flag_GhcVersion
deriving (Eq)
@@ -152,5 +153,7 @@ options backwardsCompat =
Option [] ["use-package"] (ReqArg Flag_UsePackage "PACKAGE")
"the modules being processed depend on PACKAGE",
Option [] ["optghc"] (ReqArg Flag_OptGhc "OPTION")
- "Forward option to GHC"
+ "Forward option to GHC",
+ Option [] ["ghc-version"] (NoArg Flag_GhcVersion)
+ "output GHC version in numeric format"
]
diff --git a/src/Main.hs b/src/Main.hs
index 77bcbdbb..18001c85 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -249,8 +249,9 @@ dumpInterfaceFile modules homeLinks flags =
handleEasyFlags flags fileArgs = do
usage <- getUsage
- when (Flag_Help `elem` flags) (bye usage)
- when (Flag_Version `elem` flags) byeVersion
+ when (Flag_Help `elem` flags) (bye usage)
+ when (Flag_Version `elem` flags) byeVersion
+ when (Flag_GhcVersion `elem` flags) byeGhcVersion
when (null fileArgs) (bye usage)
let ghcLibDir = case [ dir | Flag_GhcLibDir dir <- flags ] of
@@ -267,6 +268,9 @@ handleEasyFlags flags fileArgs = do
"Haddock version " ++ projectVersion ++
", (c) Simon Marlow 2003; ported to the GHC-API by David Waern 2006\n"
+ byeGhcVersion = bye $
+ (fromJust $ lookup "Project version" $ compilerInfo) ++ "\n"
+
updateHTMLXRefs :: [(InterfaceFile, FilePath)] -> IO ()
updateHTMLXRefs packages = do