diff options
author | David Waern <davve@dtek.chalmers.se> | 2007-10-20 14:24:23 +0000 |
---|---|---|
committer | David Waern <davve@dtek.chalmers.se> | 2007-10-20 14:24:23 +0000 |
commit | 122bb92ffc28553b75e731639d81ce33e1cf2a28 (patch) | |
tree | 6375f06a318109c327d70045ceab967e2190b092 | |
parent | 609227fd61e9c0cca2a252ccd250544403357c97 (diff) |
Add --ghc-version option
-rw-r--r-- | src/Haddock/Options.hs | 5 | ||||
-rw-r--r-- | src/Main.hs | 8 |
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 |