From 849b49aa53fcc50064854a44d34eb1cd04e502d3 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Sun, 27 Dec 2009 19:45:09 +0100 Subject: Friendlier output. --- src/Text/Hakyll.hs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/Text/Hakyll.hs') 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 () -- cgit v1.2.3