def rotate_out
cswap-bend-cli@0.1.0.0 · switch.bend:150
import cswap-bend-cli@0.1.0.0/switch.bend as Switch
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/swpick.bend as P
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
150def rotate_out(+s: P.Sel, +ctx: SBase.Ctx, +cur: String, +curref: Json.Json, +label: String, +models: List<&2, String>, +opts: L.Opts) -> Act.of(Json.Json):
151 match s:
152 case P.SelOk{slot, warns}:
153 Act.cond(Json.Json, String.eq(slot, cur),
154 Act.pure(Json.Json, B.noop(label, "already-active", "Already on " ++ B.ref_text(curref), curref, warns)),
155 rotate_do(ctx, slot, label, warns, opts))
156 case P.SelNone{warns, exhausted}:
157 Act.pure(Json.Json, Store.sel.j(exhausted,
158 B.noop(label, "candidates-exhausted", "All other accounts are at their " ++ limits_label(models) ++ " — " ++ stay_msg(cur), curref, warns),
159 B.noop(label, "no-valid-target", "No other accounts have valid stored credentials/config.", curref, warns)))