summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Hakyll/Main.hs29
1 files changed, 24 insertions, 5 deletions
diff --git a/lib/Hakyll/Main.hs b/lib/Hakyll/Main.hs
index 5abf3a7..ae2a5bc 100644
--- a/lib/Hakyll/Main.hs
+++ b/lib/Hakyll/Main.hs
@@ -3,7 +3,13 @@
{-# LANGUAGE CPP #-}
module Hakyll.Main
- ( hakyll
+ ( optionParser
+ , commandParser
+ , defaultParser
+ , defaultParserPure
+ , defaultParserPrefs
+ , defaultParserInfo
+ , hakyll
, hakyllWith
, hakyllWithArgs
, hakyllWithExitCode
@@ -72,13 +78,26 @@ hakyllWithExitCodeAndArgs conf args rules = do
--------------------------------------------------------------------------------
defaultParser :: Config.Configuration -> IO Options
defaultParser conf =
- OA.customExecParser (OA.prefs OA.showHelpOnError)
- (OA.info (OA.helper <*> optionParser conf)
- (OA.fullDesc <> OA.progDesc
- (progName ++ " - Static site compiler created with Hakyll")))
+ OA.customExecParser defaultParserPrefs (defaultParserInfo conf)
--------------------------------------------------------------------------------
+defaultParserPure :: Config.Configuration -> [String] -> OA.ParserResult Options
+defaultParserPure conf =
+ OA.execParserPure defaultParserPrefs (defaultParserInfo conf)
+
+
+--------------------------------------------------------------------------------
+defaultParserPrefs :: OA.ParserPrefs
+defaultParserPrefs = OA.prefs OA.showHelpOnError
+
+--------------------------------------------------------------------------------
+defaultParserInfo :: Config.Configuration -> OA.ParserInfo Options
+defaultParserInfo conf =
+ OA.info (OA.helper <*> optionParser conf) (OA.fullDesc <> OA.progDesc (
+ progName ++ " - Static site compiler created with Hakyll"))
+
+--------------------------------------------------------------------------------
invokeCommands :: Command -> Config.Configuration ->
Check.Check -> Logger.Logger -> Rules a -> IO ExitCode
invokeCommands args conf check logger rules =