Commit 224b71a8039c846baa8ee1b4389f41cda336ba5b Parent: edff811793f7c3f487c6373445b44149fc3385e5 Author: mcol <mcol@posteo.net> Date: 2021-11-30 02:38:13 +0000 Committer: mcol <mcol@posteo.net> Committed: 2021-11-30 02:38:13 +0000 Print message when generating template with gitserve -t Also print warning in case the output folder already exists.
src/Main.hs Modified
@@ -8,6 +8,7 @@ import Paths_gitserve (version) +import Control.Monad (when) import qualified Data.ByteString as B import qualified Data.ByteString.UTF8 as B import Data.FileEmbed (embedDir, embedFile) @@ -95,11 +96,19 @@ tExists <- D.doesPathExist "./template" cExists <- D.doesPathExist "./config.dhall" if - | tExists -> putStrLn "Failed - './template' already exists." - | cExists -> putStrLn "Failed - './config.dhall' already exists." + | tExists -> putStrLn "Failed - ./template already exists." + | cExists -> putStrLn "Failed - ./config.dhall already exists." | otherwise -> do mapM_ (uncurry place) base B.writeFile "./config.dhall" config + putStrLn "A base template as been put at ./template." + putStrLn "A plain config has been put at ./config.dhall" + putStrLn "Add a local git repository to repoPaths in the config" + putStrLn "and run gitserve to generate HTML in ./output." + oExists <- D.doesPathExist "./output" + when oExists . putStrLn $ + "WARNING: ./output ALREADY EXISTS AND WILL BE OVERWRITTEN\n" + <> "UNLESS YOU MOVE/RENAME IT OR CHANGE GITSERVE'S outputDirectory." where base :: [(FilePath, B.ByteString)] base = $(embedDir "templates/base")