diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2009-12-27 19:45:09 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2009-12-27 19:45:09 +0100 |
commit | 849b49aa53fcc50064854a44d34eb1cd04e502d3 (patch) | |
tree | 39eb29a28dcd8e5e0a9c4b0f7cf52c6992ed6433 /src | |
parent | 3221ff61fb04ce9f72553d48c6552aefc1715e69 (diff) | |
download | hakyll-849b49aa53fcc50064854a44d34eb1cd04e502d3.tar.gz |
Friendlier output.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Hakyll.hs | 12 |
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 () |