shake.hs 801 Bytes
Newer Older
Valentin Reis's avatar
Valentin Reis committed
1
#! /usr/bin/env nix-shell
Valentin Reis's avatar
Valentin Reis committed
2
#! nix-shell -i runhaskell -A preCommit
Valentin Reis's avatar
Valentin Reis committed
3 4 5 6 7 8 9 10 11 12 13 14 15

import           Development.Shake
import           Development.Shake.FilePath
import           Control.Monad

main = shakeArgs shakeOptions $ do
  phony "clean" $ do
    removeFilesAfter "completion" ["//*"]
    removeFilesAfter "." ["README.md"]

  want ["README.md", "completion/argotk.sh"]

  "completion/*.sh"
Valentin Reis's avatar
Valentin Reis committed
16 17 18 19
    %> \out -> do
      let  cplA = cmd "argotk" ["--bash-completion-script", "argotk"]
      (Stdout cplScript) <- cplA
      liftIO $ writeFile out cplScript
Valentin Reis's avatar
Valentin Reis committed
20 21 22

  "README.md" %> \out -> do
    let template = ".README.md"
Valentin Reis's avatar
Valentin Reis committed
23
    need [template , "src/argotk.hs" , "src/Argo/Stack.hs"]
Valentin Reis's avatar
Valentin Reis committed
24 25 26
    (Stdout panpipe) <- cmd "which panpipe"
    cmd_ "pandoc --filter"
         [take (length panpipe - 1) panpipe, template, "-o", out]
Valentin Reis's avatar
Valentin Reis committed
27