#!/usr/bin/env stack
-- stack script --resolver lts-8.12 --package turtle --package markdown-unlit -- "-pgmL markdown-unlit"
{-# LANGUAGE OverloadedStrings #-}
import TurtleLiterate README
The readme that builds itself!
You can setup and build this project by running this very readme. This is what the travis job does!
Example: ./README.lhs --setup --test
parser :: Parser (Bool, Bool, Bool)
parser = (,,) <$> switch "setup" 's' "Set up the stack environment."
<*> switch "test" 't' "Build the project and run the tests."
<*> switch "build" 'b' "Just build, don't run tests."main = void $ do
(setup, test, build) <- options "Literate README" parser
let ops = doSetup setup .&&. doBuild build .&&. doTest test
ops .||. die "Step failed."
nop = shell "true" empty
stackOrNop op True = shell ("stack " <> op) empty
stackOrNop _ _ = nopSetup
-- | Call this with: ./README.lhs --setup
doSetup = stackOrNop "setup"Build
-- | Call this with: ./README.lhs --build
doBuild = stackOrNop "build"Test
-- | Call this with: ./README.lhs --test
doTest = stackOrNop "test"