@@ -41,15 +41,15 @@ hakyllWith conf rules = do
4141 if internal_links args' then Check.InternalLinks else Check.All
4242
4343 case args' of
44− Build _ -> Commands.build conf verbosity' rules >>= exitWith
45− Check _ _ -> Commands.check conf verbosity' check'
46− Clean _ -> Commands.clean conf
47− Deploy _ -> Commands.deploy conf >>= exitWith
48− Help _ -> showHelp
49− Preview _ p -> Commands.preview conf verbosity' rules p
50− Rebuild _ -> Commands.rebuild conf verbosity' rules >>= exitWith
51− Server _ _ -> Commands.server conf (port args')
52− Watch _ -> Commands.watch conf verbosity' rules
44+ Build _ -> Commands.build conf verbosity' rules >>= exitWith
45+ Check _ _ -> Commands.check conf verbosity' check'
46+ Clean _ -> Commands.clean conf
47+ Deploy _ -> Commands.deploy conf >>= exitWith
48+ Help _ -> showHelp
49+ Preview _ p -> Commands.preview conf verbosity' rules p
50+ Rebuild _ -> Commands.rebuild conf verbosity' rules >>= exitWith
51+ Server _ _ -> Commands.server conf (port args')
52+ Watch _ p s -> Commands.watch conf verbosity' p (not s) rules
5353
5454
5555--------------------------------------------------------------------------------
@@ -68,7 +68,7 @@ data HakyllArgs
6868 | Preview {verbose :: Bool, port :: Int}
6969 | Rebuild {verbose :: Bool}
7070 | Server {verbose :: Bool, port :: Int}
71− | Watch {verbose :: Bool}
71+ | Watch {verbose :: Bool, port :: Int, no_server :: Bool }
7272 deriving (Data, Typeable, Show)
7373
7474
@@ -82,11 +82,12 @@ hakyllArgs = modes
8282 , (Deploy $ verboseFlag def) &= help "Upload/deploy your site"
8383 , (Help $ verboseFlag def) &= help "Show this message" &= auto
8484 , (Preview (verboseFlag def) (portFlag 8000)) &=
85− help "Start a preview server and autocompile on changes"
85+ help "[Deprecated] Please use the watch command"
8686 , (Rebuild $ verboseFlag def) &= help "Clean and build again"
8787 , (Server (verboseFlag def) (portFlag 8000)) &=
8888 help "Start a preview server"
89− , (Watch (verboseFlag def) &= help "Autocompile on changes")
89+ , (Watch (verboseFlag def) (portFlag 8000) (noServerFlag False) &=
90+ help "Autocompile on changes and start a preview server")
9091 ] &= help "Hakyll static site compiler" &= program progName
9192
9293
@@ -96,6 +97,11 @@ verboseFlag x = x &= help "Run in verbose mode"
9697{-# INLINE verboseFlag #-}
9798
9899
100+--------------------------------------------------------------------------------
101+noServerFlag :: Data a => a -> a
102+noServerFlag x = x &= help "Disable the built-in web server"
103+{-# INLINE noServerFlag #-}
104+
99105--------------------------------------------------------------------------------
100106portFlag :: Data a => a -> a
101107portFlag x = x &= help "Port to listen on"