Switch.switch_auto: def of cswap-bend-cli@0.1.0.0 Import: import cswap-bend-cli@0.1.0.0/switch.bend as Switch Lines 259-269 of cswap-bend-cli@0.1.0.0/switch.bend: https://jend.leeeet.dev/read.txt?path=cswap-bend-cli@0.1.0.0/switch.bend&start_line=259&end_line=269 import Base import cswap-bend-cli@0.1.0.0/json.bend as Json import cswap-bend-cli@0.1.0.0/act.bend as Act import cswap-bend-cli@0.1.0.0/store.bend as Store import cswap-bend-cli@0.1.0.0/swbase.bend as B import cswap-bend-cli@0.1.0.0/swlive.bend as L import cswap-bend-cli@0.1.0.0/store/base.bend as SBase import cswap-bend-cli@0.1.0.0/store/io.bend as SIo # `cswap switch [--strategy best|next-available] [--model NAMES]`: strategy # "" rotates through `sequence`; "next-available" also skips accounts with no # headroom; "best" moves to the account with strictly more headroom. Usage is # read from cache/usage.json as it stands (no fetch). A logged-out machine # activates the active (else first) slot. The result is the object of # contract 2.3; no-op outcomes are results, not errors. A live unmanaged login # is reported as `unmanaged-account` (the CLI adds it with Store.add_current). def switch_auto(+ctx: SBase.Ctx, +strategy: String, +models: List<&2, String>, +opts: L.Opts) -> Act.of(Json.Json): do ActM: m : Maybe<&2, Json.Json> <- SIo.read_seq(SBase.root_of(ctx)) auto1(strategy, ctx, B.sel_s(String.eq(strategy, "best") || String.eq(strategy, "next-available"), strategy, "rotation"), B.sel_ls(String.eq(strategy, "best") || String.eq(strategy, "next-available"), models, []), opts, m) Uses (16): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.or https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.eq https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/act.bend&name=of https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/json.bend&name=Json https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/store/base.bend&name=Ctx https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/store/base.bend&name=root_of https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/store/io.bend&name=read_seq https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/swbase.bend&name=sel_ls https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/swbase.bend&name=sel_s https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/switch.bend&name=ActM https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/switch.bend&name=ActM.bind https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/switch.bend&name=auto1 https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/swlive.bend&name=Opts