aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Haddock/Options.hs3
-rw-r--r--src/Main.hs10
2 files changed, 10 insertions, 3 deletions
diff --git a/src/Haddock/Options.hs b/src/Haddock/Options.hs
index 3f1b29b8..9699e6ee 100644
--- a/src/Haddock/Options.hs
+++ b/src/Haddock/Options.hs
@@ -91,6 +91,7 @@ data Flag
| Flag_OptGhc String
| Flag_GhcLibDir String
| Flag_GhcVersion
+ | Flag_PrintGhcLibDir
| Flag_NoWarnings
| Flag_UseUnicode
deriving (Eq)
@@ -161,5 +162,7 @@ options backwardsCompat =
"option to be forwarded to GHC",
Option [] ["ghc-version"] (NoArg Flag_GhcVersion)
"output GHC version in numeric format",
+ Option [] ["print-ghc-libdir"] (NoArg Flag_PrintGhcLibDir)
+ "output GHC lib dir",
Option ['w'] ["no-warnings"] (NoArg Flag_NoWarnings) "turn off all warnings"
]
diff --git a/src/Main.hs b/src/Main.hs
index a676d9a8..465ebfd8 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -433,9 +433,13 @@ handleEasyFlags :: [Flag] -> IO ()
handleEasyFlags 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_GhcVersion `elem` flags) byeGhcVersion
+
+ when (Flag_PrintGhcLibDir `elem` flags) $ do
+ dir <- getGhcLibDir flags
+ bye $ dir ++ "\n"
when (Flag_UseUnicode `elem` flags && not (Flag_Html `elem` flags)) $
throwE ("Unicode can only be enabled for HTML output.")