aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Waern <david.waern@gmail.com>2010-07-22 16:50:46 +0000
committerDavid Waern <david.waern@gmail.com>2010-07-22 16:50:46 +0000
commit4be7e1868c4973034e1b14cd11672673aa2eb64a (patch)
tree330e4874836479a8f31008a205c386a53abf4fff
parent1aa5ee611c0dab8201d282da38c916416ee48eb1 (diff)
Fix a bug where we allowed --hoogle, --latex, etc without input files
-rw-r--r--src/Main.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 03c003d4..957ef5c5 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -151,6 +151,9 @@ main = handleTopExceptions $ do
Nothing -> return ()
else do
+ when (any (`elem` [Flag_Html, Flag_Xhtml, Flag_Hoogle, Flag_LaTeX]) flags) $
+ throwE "No input file(s)."
+
-- Get packages supplied with --read-interface.
packages <- readInterfaceFiles freshNameCache (ifacePairs flags)
@@ -351,6 +354,18 @@ handleEasyFlags flags = do
when ((Flag_GenIndex `elem` flags || Flag_GenContents `elem` flags)
&& Flag_Html `elem` flags) $
throwE "-h cannot be used with --gen-index or --gen-contents"
+
+ when ((Flag_GenIndex `elem` flags || Flag_GenContents `elem` flags)
+ && Flag_Xhtml `elem` flags) $
+ throwE "--xhtml cannot be used with --gen-index or --gen-contents"
+
+ when ((Flag_GenIndex `elem` flags || Flag_GenContents `elem` flags)
+ && Flag_Hoogle `elem` flags) $
+ throwE "--hoogle cannot be used with --gen-index or --gen-contents"
+
+ when ((Flag_GenIndex `elem` flags || Flag_GenContents `elem` flags)
+ && Flag_LaTeX `elem` flags) $
+ throwE "--latex cannot be used with --gen-index or --gen-contents"
where
byeVersion = bye $
"Haddock version " ++ projectVersion ++ ", (c) Simon Marlow 2006\n"