tui/model.bend checks
raw source on the hub · import cswap-bend-cli@0.1.0.0/tui/model.bend as Model
1 import
import Base
Types
type Win source · line 8 · raw
Data
One usage window: "5h", "7d" or a model name; None pct is unknown.
Win@label:String -> @pct:Maybe<&2, U32> -> @reset:Maybe<&2, U32> -> Win
type Acct source · line 13 · raw
Data
One managed account. age is the seconds since its last good reading;
note explains an unreadable one ("" when there is nothing to say).
Acct@slot:String -> @email:String -> @alias:String -> @tag:String -> @active:Bool -> @disabled:Bool -> @wins:List<&2, Win> -> @age:Maybe<&2, U32> -> @note:String -> Acct
type Hdr source · line 17 · raw
Data
The auto-switch line: is the daemon running, and its settings.
Hdr@version:String -> @live:Bool -> @pid:Maybe<&2, U32> -> @threshold:Maybe<&2, U32> -> @interval:Maybe<&2, U32> -> @next_poll:Maybe<&2, U32> -> Hdr
type Snap source · line 22 · raw
Data
Everything for one frame. off is the local UTC offset biased by 86400
(Clock.tz), log the last daemon.log lines, already formatted.
Snap@now:U32 -> @off:U32 -> @hdr:Hdr -> @accts:List<&2, Acct> -> @log:List<&2, String> -> Snap
type View source · line 26 · raw
Data
How to draw it: terminal width in columns, colour on or off (NO_COLOR).
View@width:U32 -> @color:Bool -> View
Definitions
def win_label source · line 29 · raw
@+w:Win -> String
def win_pct source · line 34 · raw
@+w:Win -> Maybe<&2, U32>
def win_reset source · line 39 · raw
@+w:Win -> Maybe<&2, U32>
def acct_wins source · line 44 · raw
@+a:Acct -> List<&2, Win>
def acct_slot source · line 49 · raw
@+a:Acct -> String
def acct_active source · line 54 · raw
@+a:Acct -> Bool
def acct_disabled source · line 59 · raw
@+a:Acct -> Bool
def acct_email source · line 64 · raw
@+a:Acct -> String
def acct_age source · line 69 · raw
@+a:Acct -> Maybe<&2, U32>
def acct_note source · line 74 · raw
@+a:Acct -> String