~/bend-docscommunity

fmt/out.bend checks

raw source on the hub · import cswap-bend-cli@0.1.0.0/fmt/out.bend as Out

7 imports
import Base
import ../json.bend as Json
import ../cmd.bend as Cmd
import ./shape.bend as Shape
import ./yaml.bend as Yaml
import ./toon.bend as Toon
import ./code.bend as Code

Types

type Fmt source · line 12 · raw

Data

Definitions

def of_code source · line 20 · raw

@+n:U32 -> Fmt

The format a code (code.bend) stands for.

def of_name.code source · line 26 · raw

@m:Maybe<&2, U32> -> Maybe<&2, Fmt>

def of_name source · line 33 · raw

@+s:String -> Maybe<&2, Fmt>

def name source · line 36 · raw

@f:Fmt -> String

def is_text source · line 49 · raw

@f:Fmt -> Bool

def is_json source · line 56 · raw

@f:Fmt -> Bool

def render source · line 65 · raw

@f:Fmt -> @+key:String -> @+j:0x0717344745a30ebad1f19045228e8f18/json.Json -> String

The document in the format, ending in a newline. key names the CSV shape (see shape.bend).

def is_container source · line 78 · raw

@j:0x0717344745a30ebad1f19045228e8f18/json.Json -> Bool

def is_doc source · line 87 · raw

@r:Result<&2, &2, String, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> Bool

def unwrap_doc source · line 94 · raw

@r:Result<&2, &2, String, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> 0x0717344745a30ebad1f19045228e8f18/json.Json

def message_doc source · line 101 · raw

@+m:String -> 0x0717344745a30ebad1f19045228e8f18/json.Json

def strip_error source · line 104 · raw

@+m:String -> String

def error_doc source · line 107 · raw

@+m:String -> 0x0717344745a30ebad1f19045228e8f18/json.Json

def text_of source · line 110 · raw

@+out:String -> @+err:String -> String

def plain source · line 113 · raw

@+code:U32 -> @+out:String -> @+err:String -> Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/json.Json>

def doc2 source · line 117 · raw

@ok:Bool -> @r:Result<&2, &2, String, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> @+code:U32 -> @+out:String -> @+err:String -> Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/json.Json>

def doc_of source · line 128 · raw

@o:0x0717344745a30ebad1f19045228e8f18/cmd.Out -> Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/json.Json>

The JSON document a command's output stands for: its own JSON when stdout holds an object or array; else {schemaVersion, message} for a success and {schemaVersion, error:{type, message}} for an exit-1 error that went to stderr; none for a usage error (exit 2).

def keep_err source · line 133 · raw

@code:U32 -> @out:String -> @err:String -> String

def conv2 source · line 136 · raw

@f:Fmt -> @key:String -> @o:0x0717344745a30ebad1f19045228e8f18/cmd.Out -> @j:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/cmd.Out

def conv source · line 141 · raw

@f:Fmt -> @key:String -> @o:0x0717344745a30ebad1f19045228e8f18/cmd.Out -> @m:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> 0x0717344745a30ebad1f19045228e8f18/cmd.Out

def convert source · line 150 · raw

@f:Fmt -> @key:String -> @+o:0x0717344745a30ebad1f19045228e8f18/cmd.Out -> 0x0717344745a30ebad1f19045228e8f18/cmd.Out

The command's output in format f (text leaves it alone, and so does json when the command already printed JSON: that output is the --json output).

def stream_head source · line 160 · raw

@f:Fmt -> String

Printed once before the first event (CSV: the header line).

def event_text source · line 169 · raw

@f:Fmt -> @+e:0x0717344745a30ebad1f19045228e8f18/json.Json -> String

One event as the text IO.print puts on its own line(s): a JSON line, a CSV row, a --- YAML document, a TOON document followed by a blank line.