on master help sign in
guard explained
commit9c9fe95a3580307215d76f130102729c5bb521c9 authorJavran Cheng <Javran.c@gmail.com> dateFri 25 Sep 2015, 07:28 (11 years ago) parent5b36fea
1 file changed+6
src/Hakyll/Init.hs+6
src/Hakyll/Init.hs+6
@@ -31,6 +31,12 @@ main = do
3131 files <- getRecursiveContents (const $ return False) srcDir
3232
3333 case args of
34+ -- When the argument begins with hyphens, it's more likely that the user
35+ -- intends to attempt some arguments like ("--help", "-h", "--version", etc.)
36+ -- rather than create directory with that name.
37+ -- If dstDir begins with hyphens, the guard will prevent it from creating
38+ -- directory with that name so we can fall to the second alternative
39+ -- which prints a usage info for user.
3440 [dstDir] | not ("-" `isPrefixOf` dstDir) -> do
3541 forM_ files $ \file -> do
3642 let dst = dstDir </> file