aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2018-08-12 04:36:27 +0200
committerDaniel Gröber <dxld@darkboxed.org>2018-08-12 14:48:47 +0200
commite4a06a26b56dd76d783f2b4e45528ac8ee3028a5 (patch)
treebdfa150f01341d611e6eca91df0a0fbb68995041 /src
parent1fbc090874cc9631cc54898b0af58583ce35bc29 (diff)
Add --help option to wrapper
Diffstat (limited to 'src')
-rw-r--r--src/CabalHelper/Compiletime/Types.hs5
-rw-r--r--src/CabalHelper/Compiletime/Wrapper.hs5
2 files changed, 7 insertions, 3 deletions
diff --git a/src/CabalHelper/Compiletime/Types.hs b/src/CabalHelper/Compiletime/Types.hs
index 297f785..07d0266 100644
--- a/src/CabalHelper/Compiletime/Types.hs
+++ b/src/CabalHelper/Compiletime/Types.hs
@@ -26,7 +26,8 @@ module CabalHelper.Compiletime.Types where
import Data.Version
data Options = Options {
- oVerbose :: Bool
+ oHelp :: Bool
+ , oVerbose :: Bool
, oGhcProgram :: FilePath
, oGhcPkgProgram :: FilePath
, oCabalProgram :: FilePath
@@ -37,4 +38,4 @@ data Options = Options {
newtype PackageDbDir = PackageDbDir { unPackageDbDir :: FilePath }
defaultOptions :: Options
-defaultOptions = Options False "ghc" "ghc-pkg" "cabal" Nothing Nothing
+defaultOptions = Options False False "ghc" "ghc-pkg" "cabal" Nothing Nothing
diff --git a/src/CabalHelper/Compiletime/Wrapper.hs b/src/CabalHelper/Compiletime/Wrapper.hs
index 3ea3462..ae936f3 100644
--- a/src/CabalHelper/Compiletime/Wrapper.hs
+++ b/src/CabalHelper/Compiletime/Wrapper.hs
@@ -65,7 +65,9 @@ usage = do
globalArgSpec :: [OptDescr (Options -> Options)]
globalArgSpec =
- [ option "" ["verbose"] "Be more verbose" $
+ [ option "h" ["help"] "Display help message" $
+ NoArg $ \o -> o { oHelp = True }
+ , option "" ["verbose"] "Be more verbose" $
NoArg $ \o -> o { oVerbose = True }
, option "" ["with-ghc"] "GHC executable to use" $
@@ -137,6 +139,7 @@ main = handlePanic $ do
(opts', args) <- parseCommandArgs defaultOptions <$> getArgs
opts <- overrideVerbosityEnvVar =<< guessProgramPaths opts'
case args of
+ _ | oHelp opts -> usage
[] -> usage
"help":[] -> usage
"version":[] -> putStrLn $ showVersion version