25 lines
691 B
Plaintext
25 lines
691 B
Plaintext
|
|
#!/usr/bin/env nu
|
||
|
|
# typecheck-all-ncl.nu — Run nickel typecheck on all .ncl files. Exit 1 on any failure.
|
||
|
|
|
||
|
|
def main []: nothing -> nothing {
|
||
|
|
let all_files = (glob "**/*.ncl" | where { |f|
|
||
|
|
not ($f | str contains "/.git/")
|
||
|
|
})
|
||
|
|
|
||
|
|
let results = ($all_files | each { |f|
|
||
|
|
let r = (do { ^nickel typecheck $f } | complete)
|
||
|
|
{ file: $f, ok: ($r.exit_code == 0), err: $r.stderr }
|
||
|
|
})
|
||
|
|
|
||
|
|
let failures = ($results | where { |r| not $r.ok })
|
||
|
|
|
||
|
|
if (($failures | length) > 0) {
|
||
|
|
$failures | each { |f|
|
||
|
|
print $"FAIL ($f.file):\n($f.err)"
|
||
|
|
}
|
||
|
|
error make { msg: $"($failures | length) Nickel typecheck failures" }
|
||
|
|
}
|
||
|
|
|
||
|
|
print $"($results | length) .ncl files typechecked"
|
||
|
|
}
|