Skip to content

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

License

Notifications You must be signed in to change notification settings

silky/literate-readme

Repository files navigation

#!/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!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published