add flag to skip printing notes

This commit is contained in:
rhiannon morris 2023-03-03 21:04:46 +01:00
parent 4dba693a5f
commit 9701ec3cd0
2 changed files with 35 additions and 25 deletions

View File

@ -294,6 +294,7 @@ run1' (index, test) = do
putOk' Yellow True index "\{test.label} # todo \{reason}"
pure $ toBool res
parameters (skipNotes : Bool)
mutual
||| run a test or group
private
@ -305,7 +306,7 @@ mutual
putOk res index label
pure res
run' (_, Note note) = do
putIndentLines [!(col Magenta "# ") ++ note]
unless skipNotes $ putIndentLines [!(col Magenta "# ") ++ note]
pure True
private
@ -347,7 +348,7 @@ main' : Options -> List Test -> IO ExitCode
main' opts tests = do
let tests = filterMatch opts.pattern $
case opts.version of V13 => flatten tests; V14 => tests
let act = do putVersion opts.version; runList tests
let act = do putVersion opts.version; runList opts.skipComments tests
pure $ if !(runReaderT (RE 0 opts.color) act)
then ExitSuccess
else ExitFailure 70

View File

@ -44,6 +44,9 @@ record Options where
||| colour code test results and a few other things.
||| this is not TAP compliant so it is off by default.
color : Bool
||| `-q`, `--skip-comments`:
||| skip printing comments in the output
skipComments : Bool
||| default options
||| (version 13 (because of `prove`), no filter, no colour)
@ -52,7 +55,8 @@ defaultOpts : Options
defaultOpts = Opts {
version = V13,
pattern = Nothing,
color = False
color = False,
skipComments = False
}
||| value for each option.
@ -114,6 +118,11 @@ parameters (header : String)
description = "colour-code results (not TAP compliant)",
shortNames = ['c'], longNames = ["color", "colour"],
argDescr = NoArg $ pure . {color := True}
},
MkOpt {
description = "skip printing comments in the output",
shortNames = ['q'], longNames = ["skip-comments"],
argDescr = NoArg $ pure . {skipComments := True}
}
]