From 7a6b3777157e2a1e63d662b354104229cf773342 Mon Sep 17 00:00:00 2001 From: David Waern Date: Fri, 25 Nov 2011 02:30:41 +0100 Subject: Add flag --interface-version. --- src/Haddock/InterfaceFile.hs | 2 +- src/Haddock/Options.hs | 3 +++ src/Main.hs | 9 ++++----- 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) -- cgit v1.2.3