def event_text

cswap-bend-cli@0.1.0.0 · fmt/out.bend:167

import cswap-bend-cli@0.1.0.0/fmt/out.bend as Out
import Base
import cswap-bend-cli@0.1.0.0/json.bend as Json
import cswap-bend-cli@0.1.0.0/fmt/shape.bend as Shape
import cswap-bend-cli@0.1.0.0/fmt/yaml.bend as Yaml
import cswap-bend-cli@0.1.0.0/fmt/toon.bend as Toon

167# One event as the text IO.print puts on its own line(s): a JSON line, a CSV
168# row, a `---` YAML document, a TOON document followed by a blank line.
169def event_text(f: Fmt, +e: Json.Json) -> String:
170  match f:
171    case FCsv{}:
172      Shape.event_row(e)
173    case FYaml{}:
174      "---\n" ++ Yaml.emit(e)
175    case FToon{}:
176      Toon.emit(e) ++ "\n"
177    case _:
178      Json.emit_py(e)

Uses (8)

Used by (1)