diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-12-06 13:41:16 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-12-06 13:41:16 +0100 |
commit | 7d20671bb3ff7b970ff7556ed18fd5714ab962da (patch) | |
tree | 0267a7a9d0fece47c4537b860561b7ad68423a86 /src/Hakyll | |
parent | 6307ecd094c0ab2f937909dacdce08f8a4bb7780 (diff) | |
download | hakyll-7d20671bb3ff7b970ff7556ed18fd5714ab962da.tar.gz |
I have this huge hangover
Diffstat (limited to 'src/Hakyll')
-rw-r--r-- | src/Hakyll/Init.hs | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/Hakyll/Init.hs b/src/Hakyll/Init.hs index 974cacb..3e2969e 100644 --- a/src/Hakyll/Init.hs +++ b/src/Hakyll/Init.hs @@ -5,7 +5,11 @@ module Main -------------------------------------------------------------------------------- +import Control.Monad (forM_) import System.Directory (copyFile) +import System.Environment (getArgs, getProgName) +import System.Exit (exitFailure) +import System.FilePath ((</>)) -------------------------------------------------------------------------------- @@ -16,8 +20,18 @@ import Paths_hakyll -------------------------------------------------------------------------------- main :: IO () main = do - let dstDir = "." - srcDir <- getDataFileName "example" - files <- getRecursiveContents srcDir - print files - return () + progName <- getProgName + args <- getArgs + srcDir <- getDataFileName "example" + files <- getRecursiveContents srcDir + + case args of + [dstDir] -> forM_ files $ \file -> do + let dst = dstDir </> file + src = srcDir </> file + putStrLn $ "Creating " ++ dst + makeDirectories dst + copyFile src dst + _ -> do + putStrLn $ "Usage: " ++ progName ++ " <directory>" + exitFailure |