summaryrefslogtreecommitdiff
path: root/src/Text/Hakyll.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2009-12-27 19:45:09 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2009-12-27 19:45:09 +0100
commit849b49aa53fcc50064854a44d34eb1cd04e502d3 (patch)
tree39eb29a28dcd8e5e0a9c4b0f7cf52c6992ed6433 /src/Text/Hakyll.hs
parent3221ff61fb04ce9f72553d48c6552aefc1715e69 (diff)
downloadhakyll-849b49aa53fcc50064854a44d34eb1cd04e502d3.tar.gz
Friendlier output.
Diffstat (limited to 'src/Text/Hakyll.hs')
-rw-r--r--src/Text/Hakyll.hs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Text/Hakyll.hs b/src/Text/Hakyll.hs
index 39bf9e1..9d2f86c 100644
--- a/src/Text/Hakyll.hs
+++ b/src/Text/Hakyll.hs
@@ -9,19 +9,25 @@ import System.Directory (doesDirectoryExist, removeDirectoryRecursive)
-- | Main function to run hakyll.
hakyll :: IO () -> IO ()
-hakyll action = do
+hakyll buildFunction = do
args <- getArgs
- case args of [] -> action
+ case args of [] -> build buildFunction
["clean"] -> clean
["server", p] -> server (read p)
["server"] -> server 8000
_ -> help
+-- | Build the site.
+build :: IO () -> IO ()
+build buildFunction = do putStrLn "Generating..."
+ buildFunction
+
-- | Clean up directories.
clean :: IO ()
clean = do remove' "_cache"
remove' "_site"
- where remove' dir = do exists <- doesDirectoryExist dir
+ where remove' dir = do putStrLn $ "Removing " ++ dir ++ "..."
+ exists <- doesDirectoryExist dir
if exists then removeDirectoryRecursive dir
else return ()