silky / literate-readme

README files used to be able to lie. Now they can't! Woo!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#!/usr/bin/env ./go

{-# LANGUAGE OverloadedStrings #-}

import Turtle

Literate README

Build status

The readme that builds itself!

You can setup and build this project by running this very readme. This is what the CI 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 _  _    = nop

Setup

-- | 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"

About

README files used to be able to lie. Now they can't! Woo!

License:Other


Languages

Language:Haskell 51.3%Language:Shell 48.7%