aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Waern <david.waern@gmail.com>2011-11-25 02:30:41 +0100
committerDavid Waern <david.waern@gmail.com>2011-11-25 02:30:41 +0100
commit7a6b3777157e2a1e63d662b354104229cf773342 (patch)
treeba8ac1ba1e3f5ef7f21d17a6a293c25adc4eda81
parent3bdd9282ce67d1094c36204e77e3f32356a2c059 (diff)
Add flag --interface-version.
-rw-r--r--src/Haddock/InterfaceFile.hs2
-rw-r--r--src/Haddock/Options.hs3
-rw-r--r--src/Main.hs9
3 files changed, 8 insertions, 6 deletions
diff --git a/src/Haddock/InterfaceFile.hs b/src/Haddock/InterfaceFile.hs
index 24c1bc92..68bc20b6 100644
--- a/src/Haddock/InterfaceFile.hs
+++ b/src/Haddock/InterfaceFile.hs
@@ -15,7 +15,7 @@
module Haddock.InterfaceFile (
InterfaceFile(..), ifPackageId,
readInterfaceFile, nameCacheFromGhc, freshNameCache, NameCacheAccessor,
- writeInterfaceFile
+ writeInterfaceFile, binaryInterfaceVersion
) where
diff --git a/src/Haddock/Options.hs b/src/Haddock/Options.hs
index 7323a806..4e42fd32 100644
--- a/src/Haddock/Options.hs
+++ b/src/Haddock/Options.hs
@@ -62,6 +62,7 @@ data Flag
| Flag_Help
| Flag_Verbosity String
| Flag_Version
+ | Flag_InterfaceVersion
| Flag_UseContents String
| Flag_GenContents
| Flag_UseIndex String
@@ -130,6 +131,8 @@ options backwardsCompat =
"display this help and exit",
Option ['V'] ["version"] (NoArg Flag_Version)
"output version information and exit",
+ Option [] ["interface-version"] (NoArg Flag_InterfaceVersion)
+ "output interface file version and exit",
Option ['v'] ["verbosity"] (ReqArg Flag_Verbosity "VERBOSITY")
"set verbosity level",
Option [] ["use-contents"] (ReqArg Flag_UseContents "URL")
diff --git a/src/Main.hs b/src/Main.hs
index 787b5574..f78ace69 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -359,9 +359,10 @@ shortcutFlags :: [Flag] -> IO ()
shortcutFlags flags = do
usage <- getUsage
- when (Flag_Help `elem` flags) (bye usage)
- when (Flag_Version `elem` flags) byeVersion
- when (Flag_GhcVersion `elem` flags) byeGhcVersion
+ when (Flag_Help `elem` flags) (bye usage)
+ when (Flag_Version `elem` flags) byeVersion
+ when (Flag_InterfaceVersion `elem` flags) (bye (show binaryInterfaceVersion ++ "\n"))
+ when (Flag_GhcVersion `elem` flags) (bye (cProjectVersion ++ "\n"))
when (Flag_PrintGhcPath `elem` flags) $ do
dir <- fmap fst (getGhcDirs flags)
@@ -390,8 +391,6 @@ shortcutFlags flags = do
"Haddock version " ++ projectVersion ++ ", (c) Simon Marlow 2006\n"
++ "Ported to use the GHC API by David Waern 2006-2008\n"
- byeGhcVersion = bye (cProjectVersion ++ "\n")
-
updateHTMLXRefs :: [(DocPaths, InterfaceFile)] -> IO ()
updateHTMLXRefs packages = writeIORef html_xrefs_ref (Map.fromList mapping)