daemon/config.bend checks
raw source on the hub · import cswap-bend-cli@0.1.0.0/daemon/config.bend as Config
3 imports
import Base import ../json.bend as Json import ../fmt/code.bend as Code
Types
type Cfg source · line 9 · raw
Data
Cfg@threshold:U32 -> @interval:U32 -> @cooldown:U32 -> @hysteresis:U32 -> @strategy:String -> @include_api:Bool -> @unhealthy:U32 -> @models:List<&2, String> -> Cfg
type Flags source · line 12 · raw
Data
Flags@once:Bool -> @fmt:U32 -> @dry_run:Bool -> @threshold:Maybe<&2, U32> -> @interval:Maybe<&2, U32> -> @cooldown:Maybe<&2, U32> -> @strategy:Maybe<&2, String> -> @models:Maybe<&2, String> -> @include_api:Bool -> Flags
Definitions
def defaults source · line 15 · raw
Cfg
def sel_u source · line 18 · raw
@+c:Bool -> @+x:U32 -> @+y:U32 -> U32
def clamp source · line 25 · raw
@+v:U32 -> @+lo:U32 -> @+hi:U32 -> U32
def digits source · line 30 · raw
@+s:String -> Bool
def read_u32b source · line 37 · raw
@+ok:Bool -> @+s:String -> Maybe<&2, U32>
def read_u32 source · line 44 · raw
@+s:String -> Maybe<&2, U32>
def cents2 source · line 47 · raw
@+i:Maybe<&2, U32> -> @+f:Maybe<&2, U32> -> Maybe<&2, U32>
def centi2 source · line 54 · raw
@+parts:List<&2, String> -> Maybe<&2, U32>
def centi source · line 65 · raw
@+t:String -> Maybe<&2, U32>
"12.34" -> 1234, "7" -> 700, "5.5" -> 550; None for anything else (signs, exponents, text). Digits past the second decimal are dropped.
def num_text source · line 68 · raw
@+m:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> Maybe<&2, String>
def centi_of source · line 75 · raw
@+m:Maybe<&2, String> -> Maybe<&2, U32>
def field_centi2 source · line 82 · raw
@+m:Maybe<&2, U32> -> @+d:U32 -> @+lo:U32 -> @+hi:U32 -> U32
def field_centi source · line 90 · raw
@+j:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+key:String -> @+d:U32 -> @+lo:U32 -> @+hi:U32 -> U32
A numeric settings field, centi, clamped; the default when absent or not a number.
def field_secs source · line 94 · raw
@+j:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+key:String -> @+d:U32 -> @+lo:U32 -> @+hi:U32 -> U32
Whole seconds from a centi field (the fraction is dropped).
def truthy source · line 98 · raw
@+m:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> @+d:Bool -> Bool
A bool field is read by truthiness: the string "false" is true.
def pick_strategy source · line 113 · raw
@+ok:Bool -> @+s:String -> @+d:String -> String
def strategy_of source · line 122 · raw
@+m:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> @+d:String -> String
def has_ci source · line 129 · raw
@+x:String -> @+xs:List<&2, String> -> Bool
def keep_name source · line 136 · raw
@+h:String -> @+seen:List<&2, String> -> Bool
def seen_after source · line 139 · raw
@+keep:Bool -> @+h:String -> @+seen:List<&2, String> -> List<&2, String>
def out_name source · line 146 · raw
@+keep:Bool -> @+h:String -> @+rest:List<&2, String> -> List<&2, String>
def dedupe source · line 153 · raw
@+xs:List<&2, String> -> @+seen:List<&2, String> -> List<&2, String>
def trim_all source · line 160 · raw
@+xs:List<&2, String> -> List<&2, String>
def parse_models source · line 167 · raw
@+s:String -> List<&2, String>
def models_of source · line 170 · raw
@+m:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> List<&2, String>
def block_of source · line 179 · raw
@+m:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> 0x0717344745a30ebad1f19045228e8f18/json.Json
def autoswitch_block source · line 186 · raw
@+j:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/json.Json
def from_block source · line 189 · raw
@+b:0x0717344745a30ebad1f19045228e8f18/json.Json -> Cfg
def from_settings source · line 195 · raw
@+j:0x0717344745a30ebad1f19045228e8f18/json.Json -> Cfg
The lenient load: anything unreadable is the default, numbers are clamped.
def from_result source · line 198 · raw
@r:Result<&2, &2, String, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> Cfg
def from_text source · line 207 · raw
@+t:String -> Cfg
def no_flags source · line 210 · raw
Flags
def split_eq2 source · line 213 · raw
@+parts:List<&2, String> -> List<&2, String>
def split_eq_b source · line 221 · raw
@+eq:Bool -> @+a:String -> List<&2, String>
--flag value and --flag=value.
def split_eq source · line 228 · raw
@+a:String -> List<&2, String>
def normalize source · line 231 · raw
@+xs:List<&2, String> -> List<&2, String>
def bad_value source · line 238 · raw
@+flag:String -> @+kind:String -> @+v:String -> String
def with_num2 source · line 241 · raw
@+is_th:Bool -> @+is_iv:Bool -> @+f:Flags -> @+n:U32 -> Flags
def with_num source · line 250 · raw
@+f:Flags -> @+which:String -> @+n:U32 -> Flags
def set_num2 source · line 253 · raw
@+f:Flags -> @+which:String -> @+v:String -> @+c:Maybe<&2, U32> -> Result<&2, &2, String, Flags>
def set_num source · line 260 · raw
@+f:Flags -> @+which:String -> @+v:String -> Result<&2, &2, String, Flags>
def set_flag source · line 263 · raw
@+f:Flags -> @+name:String -> Flags
def set_str2 source · line 268 · raw
@+is_strategy:Bool -> @+ok:Bool -> @+f:Flags -> @+v:String -> Result<&2, &2, String, Flags>
def set_str source · line 277 · raw
@+f:Flags -> @+which:String -> @+v:String -> Result<&2, &2, String, Flags>
def takes_value source · line 280 · raw
@+a:String -> Bool
def is_bool_flag source · line 283 · raw
@+a:String -> Bool
def apply_value2 source · line 286 · raw
@+str_flag:Bool -> @+f:Flags -> @+a:String -> @+v:String -> Result<&2, &2, String, Flags>
def set_fmt2 source · line 294 · raw
@m:Maybe<&2, U32> -> @+f:Flags -> @+v:String -> Result<&2, &2, String, Flags>
--format NAME: the output format of the event stream (src/fmt/code.bend).
def apply_value3 source · line 301 · raw
@+is_fmt:Bool -> @+f:Flags -> @+a:String -> @+v:String -> Result<&2, &2, String, Flags>
def apply_value source · line 308 · raw
@+f:Flags -> @+a:String -> @+v:String -> Result<&2, &2, String, Flags>
def rest_after2 source · line 311 · raw
@+valued:Bool -> @+rest:List<&2, String> -> List<&2, String>
def rest_after source · line 318 · raw
@+a:String -> @+rest:List<&2, String> -> List<&2, String>
def valued_flag source · line 321 · raw
@+a:String -> @+rest:List<&2, String> -> @+f:Flags -> Result<&2, &2, String, Flags>
def advance2 source · line 328 · raw
@+bool_flag:Bool -> @+valued:Bool -> @+a:String -> @+rest:List<&2, String> -> @+f:Flags -> Result<&2, &2, String, Flags>
def advance source · line 337 · raw
@+a:String -> @+rest:List<&2, String> -> @+f:Flags -> Result<&2, &2, String, Flags>
def step source · line 340 · raw
@+fuel:Nat -> @+xs:List<&2, String> -> @fr:Result<&2, &2, String, Flags> -> Result<&2, &2, String, Flags>
def parse_flags source · line 348 · raw
@+args:List<&2, String> -> Result<&2, &2, String, Flags>
The flags of cswap auto (after the verb). Exit 2 territory on Fail.
def over_u source · line 353 · raw
@+m:Maybe<&2, U32> -> @+d:U32 -> U32
def over_s source · line 360 · raw
@+m:Maybe<&2, String> -> @+d:String -> String
def over_models source · line 367 · raw
@+m:Maybe<&2, String> -> @+d:List<&2, String> -> List<&2, String>
def merge source · line 374 · raw
@+c:Cfg -> @+f:Flags -> Cfg
def cfg_threshold source · line 379 · raw
@+c:Cfg -> U32
def cfg_models source · line 384 · raw
@+c:Cfg -> List<&2, String>
def cfg_interval source · line 389 · raw
@+c:Cfg -> U32
def cfg_strategy source · line 394 · raw
@+c:Cfg -> String
def cfg_cooldown source · line 399 · raw
@+c:Cfg -> U32
def cfg_include_api source · line 404 · raw
@+c:Cfg -> Bool