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

View file

@ -20,13 +20,19 @@ record TestBase where
run : IO Result 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 private
toLines : Info -> List String toLines : Info -> List String
toLines [] = [] toLines [] = []
toLines xs = toLines xs = "---" :: concatMap toLines1 xs <+> ["..."]
"---" ::
concatMap (\(k, v) => "\{k}: |" :: map (indent 2) (lines v)) xs
<+> ["..."]
public export interface ToInfo e where toInfo : e -> Info public export interface ToInfo e where toInfo : e -> Info