summaryrefslogtreecommitdiff
path: root/src/Hakyll/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Hakyll/Main.hs')
-rw-r--r--src/Hakyll/Main.hs30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/Hakyll/Main.hs b/src/Hakyll/Main.hs
index efa6d99..b8e0444 100644
--- a/src/Hakyll/Main.hs
+++ b/src/Hakyll/Main.hs
@@ -41,15 +41,15 @@ hakyllWith conf rules = do
if internal_links args' then Check.InternalLinks else Check.All
case args' of
- Build _ -> Commands.build conf verbosity' rules >>= exitWith
- Check _ _ -> Commands.check conf verbosity' check'
- Clean _ -> Commands.clean conf
- Deploy _ -> Commands.deploy conf >>= exitWith
- Help _ -> showHelp
- Preview _ p -> Commands.preview conf verbosity' rules p
- Rebuild _ -> Commands.rebuild conf verbosity' rules >>= exitWith
- Server _ _ -> Commands.server conf (port args')
- Watch _ -> Commands.watch conf verbosity' rules
+ Build _ -> Commands.build conf verbosity' rules >>= exitWith
+ Check _ _ -> Commands.check conf verbosity' check'
+ Clean _ -> Commands.clean conf
+ Deploy _ -> Commands.deploy conf >>= exitWith
+ Help _ -> showHelp
+ Preview _ p -> Commands.preview conf verbosity' rules p
+ Rebuild _ -> Commands.rebuild conf verbosity' rules >>= exitWith
+ Server _ _ -> Commands.server conf (port args')
+ Watch _ p s -> Commands.watch conf verbosity' p (not s) rules
--------------------------------------------------------------------------------
@@ -68,7 +68,7 @@ data HakyllArgs
| Preview {verbose :: Bool, port :: Int}
| Rebuild {verbose :: Bool}
| Server {verbose :: Bool, port :: Int}
- | Watch {verbose :: Bool}
+ | Watch {verbose :: Bool, port :: Int, no_server :: Bool }
deriving (Data, Typeable, Show)
@@ -82,11 +82,12 @@ hakyllArgs = modes
, (Deploy $ verboseFlag def) &= help "Upload/deploy your site"
, (Help $ verboseFlag def) &= help "Show this message" &= auto
, (Preview (verboseFlag def) (portFlag 8000)) &=
- help "Start a preview server and autocompile on changes"
+ help "[Deprecated] Please use the watch command"
, (Rebuild $ verboseFlag def) &= help "Clean and build again"
, (Server (verboseFlag def) (portFlag 8000)) &=
help "Start a preview server"
- , (Watch (verboseFlag def) &= help "Autocompile on changes")
+ , (Watch (verboseFlag def) (portFlag 8000) (noServerFlag False) &=
+ help "Autocompile on changes and start a preview server")
] &= help "Hakyll static site compiler" &= program progName
@@ -97,6 +98,11 @@ verboseFlag x = x &= help "Run in verbose mode"
--------------------------------------------------------------------------------
+noServerFlag :: Data a => a -> a
+noServerFlag x = x &= help "Disable the built-in web server"
+{-# INLINE noServerFlag #-}
+
+--------------------------------------------------------------------------------
portFlag :: Data a => a -> a
portFlag x = x &= help "Port to listen on"
{-# INLINE portFlag #-}