put single line yaml info on one line

This commit is contained in:
rhiannon morris 2022-04-27 14:57:41 +02:00
parent bcd4544692
commit d74b056e11
1 changed files with 10 additions and 4 deletions

View File

@ -20,13 +20,19 @@ record TestBase where
run : IO Result
private
toLines1 : (String, String) -> List String
toLines1 (k, v) =
let vs = lines v in
if length vs == 1
then ["\{k}: \{v}"]
else "\{k}: |" :: map (indent 2) vs
private
toLines : Info -> List String
toLines [] = []
toLines xs =
"---" ::
concatMap (\(k, v) => "\{k}: |" :: map (indent 2) (lines v)) xs
<+> ["..."]
toLines xs = "---" :: concatMap toLines1 xs <+> ["..."]
public export interface ToInfo e where toInfo : e -> Info