~/bend-docscommunity

setwrite.bend checks

raw source on the hub · import cswap-bend-cli@0.1.0.0/setwrite.bend as Setwrite

8 imports
import Base
import ./setload.bend as Setload
import ./fs/write.bend as FWrite
import ./json.bend as Json
import ./fs.bend as Fs
import ./act.bend as Act
import ./cmd.bend as Cmd
import ./settings.bend as Settings

Types

type Parsed source · line 10 · raw

Data

type Row source · line 177 · raw

Data

Definitions

def strip_sign source · line 14 · raw

@+t:String -> String

def special.w source · line 17 · raw

@+w:String -> Bool

def special source · line 21 · raw

@t:String -> Bool

float() accepts these and they are never inside a range.

def int.pick source · line 24 · raw

@ok:Bool -> @t:String -> Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/settings.Dec>

def int.cand source · line 32 · raw

@+t:String -> Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/settings.Dec>

int(): an optional sign and digits only.

def cand.pick source · line 35 · raw

@isint:Bool -> @t:String -> Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/settings.Dec>

def range_msg source · line 42 · raw

@dot:String -> @lo:String -> @hi:String -> String

def parse.chk source · line 45 · raw

@bad:Bool -> @isint:Bool -> @msg:String -> @d:0x0717344745a30ebad1f19045228e8f18/settings.Dec -> Parsed

def parse.dec source · line 52 · raw

@m:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/settings.Dec> -> @isint:Bool -> @+dot:String -> @raw:String -> @+lo:String -> @+hi:String -> Parsed

def parse.number2 source · line 59 · raw

@inf:Bool -> @+isint:Bool -> @+dot:String -> @raw:String -> @+lo:String -> @+hi:String -> @t:String -> Parsed

def parse.number source · line 66 · raw

@+isint:Bool -> @dot:String -> @+raw:String -> @lo:String -> @hi:String -> Parsed

def bool.word2 source · line 69 · raw

@t:Bool -> @f:Bool -> Maybe<&2, Bool>

def bool.word source · line 78 · raw

@+w:String -> Maybe<&2, Bool>

def parse.bool2 source · line 82 · raw

@m:Maybe<&2, Bool> -> @dot:String -> @raw:String -> Parsed

def parse.choice2 source · line 89 · raw

@ok:Bool -> @dot:String -> @choices:String -> @raw:String -> Parsed

def parse.str2 source · line 96 · raw

@Setload.empty:Bool -> @+dot:String -> @v:String -> Parsed

def parse.kind source · line 103 · raw

@kind:0x0717344745a30ebad1f19045228e8f18/settings.Sort -> @+dot:String -> @+raw:String -> @lo:String -> @hi:String -> @+choices:String -> Parsed

def parse_value source · line 118 · raw

@sp:0x0717344745a30ebad1f19045228e8f18/settings.Spec -> @raw:String -> Parsed

Strictly parse the text given to config set: out of range or mistyped is a Bad{message}, never clamped.

def is_float.kind source · line 123 · raw

@k:0x0717344745a30ebad1f19045228e8f18/settings.Sort -> Bool

def is_float source · line 130 · raw

@sp:0x0717344745a30ebad1f19045228e8f18/settings.Spec -> Bool

def has.in source · line 135 · raw

@sec:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> @key:String -> Bool

def is_set source · line 143 · raw

@raw:0x0717344745a30ebad1f19045228e8f18/json.Json -> @sp:0x0717344745a30ebad1f19045228e8f18/settings.Spec -> Bool

Is the key present in the raw file (an explicit default still counts)?

def set_in source · line 149 · raw

@+raw:0x0717344745a30ebad1f19045228e8f18/json.Json -> @sp:0x0717344745a30ebad1f19045228e8f18/settings.Spec -> @v:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/json.Json

raw[section][key] = v, with schemaVersion defaulted; only that key written.

def obj_empty source · line 154 · raw

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

def unset.fin source · line 161 · raw

@gone:Bool -> @+section:String -> @+sect:0x0717344745a30ebad1f19045228e8f18/json.Json -> @r2:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/json.Json

def unset.fin2 source · line 168 · raw

@+sect:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+section:String -> @r2:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/json.Json

def unset_in source · line 172 · raw

@+raw:0x0717344745a30ebad1f19045228e8f18/json.Json -> @sp:0x0717344745a30ebad1f19045228e8f18/settings.Spec -> 0x0717344745a30ebad1f19045228e8f18/json.Json

del raw[section][key]; an emptied section goes too.

def value_of source · line 180 · raw

@+norm:0x0717344745a30ebad1f19045228e8f18/json.Json -> @sp:0x0717344745a30ebad1f19045228e8f18/settings.Spec -> 0x0717344745a30ebad1f19045228e8f18/json.Json

def rows source · line 185 · raw

@+raw:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+norm:0x0717344745a30ebad1f19045228e8f18/json.Json -> @xs:List<&2, 0x0717344745a30ebad1f19045228e8f18/settings.Spec> -> List<&2, Row>

def effective source · line 193 · raw

@+raw:0x0717344745a30ebad1f19045228e8f18/json.Json -> List<&2, Row>

(spec, effective value, explicitly set?) per key, registry order.

def fmt.num source · line 196 · raw

@isfloat:Bool -> @+t:String -> String

def fmt.val source · line 200 · raw

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

format_setting_value

def row.key source · line 213 · raw

@r:Row -> String

def row.val source · line 218 · raw

@r:Row -> String

def row.json source · line 223 · raw

@r:Row -> 0x0717344745a30ebad1f19045228e8f18/json.Json

def rows.json source · line 228 · raw

@rs:List<&2, Row> -> List<&2, 0x0717344745a30ebad1f19045228e8f18/json.Json>

def row.find.pick source · line 235 · raw

@hit:Bool -> @r:Row -> @rest:Maybe<&2, Row> -> Maybe<&2, Row>

def row.find source · line 242 · raw

@+key:String -> @rs:List<&2, Row> -> Maybe<&2, Row>

def keys.of source · line 249 · raw

@rs:List<&2, Row> -> List<&2, String>

def vals.of source · line 256 · raw

@rs:List<&2, Row> -> List<&2, String>

def width source · line 263 · raw

@xs:List<&2, String> -> @acc:Nat -> Nat

def pad source · line 270 · raw

@+s:String -> @n:Nat -> String

def line source · line 273 · raw

@kw:Nat -> @vw:Nat -> @+r:Row -> String

def lines source · line 278 · raw

@+kw:Nat -> @+vw:Nat -> @rs:List<&2, Row> -> List<&2, String>

def list.text source · line 287 · raw

@+rs:List<&2, Row> -> String

The text of config list: padded key and value columns, (default) on the keys the file does not set.