5import Network.Hakyll.SimpleServer (simpleServer)
7import System.Environment (getArgs, getProgName)
8import System.Directory (doesDirectoryExist, removeDirectoryRecursive)
10-- | Main function to run hakyll.
11hakyll :: IO () -> IO ()
12hakyll buildFunction = do
14 case args of [] -> build buildFunction
16 ["preview", p] -> build buildFunction >> server (read p)
17 ["preview"] -> build buildFunction >> server 8000
18 ["server", p] -> server (read p)
19 ["server"] -> server 8000
23build :: IO () -> IO ()
24build buildFunction = do putStrLn "Generating..."
27-- | Clean up directories.
29clean = do remove' "_cache"
31 where remove' dir = do putStrLn $ "Removing " ++ dir ++ "..."
32 exists <- doesDirectoryExist dir
33 if exists then removeDirectoryRecursive dir
36-- | Show usage information.
40 putStrLn $ "This is a hakyll site generator program. You should always\n"
41 ++ "run it from the project root directory.\n"
44 ++ name ++ " Generate the site.\n"
45 ++ name ++ " clean Clean up and remove cache.\n"
46 ++ name ++ " help Show this message.\n"
47 ++ name ++ " preview [port] Generate site, then start a server.\n"
48 ++ name ++ " server [port] Run a local test server.\n"
50server :: Integer -> IO ()
51server p = do simpleServer (fromIntegral $ p) "_site"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list