def backup_outgoing

cswap-bend-cli@0.1.0.0 · swrun.bend:40

import cswap-bend-cli@0.1.0.0/swrun.bend as Swrun
import Base
import cswap-bend-cli@0.1.0.0/act.bend as Act
import cswap-bend-cli@0.1.0.0/swcreds.bend as C
import cswap-bend-cli@0.1.0.0/store/io.bend as SIo

40# The outgoing account's backup, by what the live credential is.
41def backup_outgoing(+k: C.CKind, +root: String, +cur: String, +email: String, +creds: String, +cfg_text: String) -> Act.of(Unit):
42  match k:
43    case C.KOwnBytes{}:
44      SIo.write_config(root, cur, email, cfg_text)
45    case C.KWiped{}:
46      SIo.write_config(root, cur, email, cfg_text)
47    case C.KForeignSynced{s}:
48      Act.pure(Unit, Unit{})
49    case C.KForeign{s}:
50      Act.pure(Unit, Unit{})
51    case C.KAlien{}:
52      Act.pure(Unit, Unit{})
53    case _:
54      do ActM<Unit>:
55        SIo.write_cred(root, cur, email, creds)
56        SIo.write_config(root, cur, email, cfg_text)

Uses (9)

Used by (1)