Skip to content

Commit 9840ad5

Browse files
author
Your Name
committed
Improve the check.hell script
* Checks the scripts/ dir * Runs all things concurrently * Adds --compiler-stats flag too
1 parent 9e0fd3f commit 9840ad5

1 file changed

Lines changed: 20 additions & 8 deletions

File tree

scripts/check.hell

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
1+
data Opts = Opts {
2+
compilerStats :: Bool
3+
}
4+
5+
options =
6+
(\compilerStats -> Main.Opts { compilerStats })
7+
<$> Options.switch (Flag.long "compiler-stats" <> Flag.help "Pass --compiler-stats in?")
8+
19
main = do
2-
examples <- Directory.listDirectory "examples/"
3-
let check = \fp -> do
4-
Text.putStrLn $ Text.concat ["Checking ", fp]
5-
Process.runProcess_ (Process.proc "hell" ["--check", fp])
6-
Monad.forM_ examples \example -> do
7-
check $ Text.concat ["examples/", example]
8-
check "scripts/static-build.hell"
9-
check "scripts/install-hell.hell"
10+
opts <- Options.execParser (Options.info (Main.options <**> Options.helper) Options.fullDesc)
11+
let extra = if Record.get @"compilerStats" opts
12+
then ["--compiler-stats"]
13+
else []
14+
let list = \dir ->
15+
Functor.fmap (List.filter (Text.isSuffixOf ".hell") . List.map (\x -> dir <> x))
16+
$ Directory.listDirectory dir
17+
examples <- list "examples/"
18+
scripts <- list "scripts/"
19+
Async.pooledForConcurrently (examples <> scripts) \fp -> do
20+
Text.putStrLn $ Text.concat ["Checking ", fp]
21+
Process.runProcess_ (Process.proc "hell" (["--check", fp] <> extra))
1022
Text.putStrLn "All OK."

0 commit comments

Comments
 (0)