summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJavran Cheng <Javran.c@gmail.com>2015-09-25 07:28:53 -0400
committerJavran Cheng <Javran.c@gmail.com>2015-09-25 07:28:53 -0400
commit9c9fe95a3580307215d76f130102729c5bb521c9 (patch)
treebe37b7cdd9a9312208039ae89c4d323013d41642 /src
parent5b36fea95cc94975d67067a3d01c92c7f49098dd (diff)
downloadhakyll-9c9fe95a3580307215d76f130102729c5bb521c9.tar.gz
guard explained
Diffstat (limited to 'src')
-rw-r--r--src/Hakyll/Init.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Hakyll/Init.hs b/src/Hakyll/Init.hs
index 816ef43..71055f0 100644
--- a/src/Hakyll/Init.hs
+++ b/src/Hakyll/Init.hs
@@ -31,6 +31,12 @@ main = do
files <- getRecursiveContents (const $ return False) srcDir
case args of
+ -- When the argument begins with hyphens, it's more likely that the user
+ -- intends to attempt some arguments like ("--help", "-h", "--version", etc.)
+ -- rather than create directory with that name.
+ -- If dstDir begins with hyphens, the guard will prevent it from creating
+ -- directory with that name so we can fall to the second alternative
+ -- which prints a usage info for user.
[dstDir] | not ("-" `isPrefixOf` dstDir) -> do
forM_ files $ \file -> do
let dst = dstDir </> file