aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Waern <david.waern@gmail.com>2009-08-15 23:52:03 +0000
committerDavid Waern <david.waern@gmail.com>2009-08-15 23:52:03 +0000
commit7f4130af50264254efa0b6c22be83b078b63d798 (patch)
tree311a098f8f37aab2a82a969a719f52129585687d
parent0c2f863e8189e6c31d0b28fa363132993e60b6d4 (diff)
Add --print-ghc-libdir
-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.")