def exec

ezx@1.11.0.0 · src/lock/run.bend:619

import ezx@1.11.0.0/src/lock/run.bend as Run
import Base
import snap@1.4.0.0/main.bend as R
import ezx@1.11.0.0/src/lock/lock.bend as L
import ezx@1.11.0.0/src/lock/plan.bend as Plan

619# one effect
620def exec(+lib: String, effect: Plan.Effect) -> IO(Unit):
621  match effect:
622    case Plan.Write{at, text}:
623      write(at, text)
624    case Plan.Lay{pl, hash, fs}:
625      +dir = place(lib, pl) ++ "/" ++ hash
626      do IO<Unit>:
627        _rm : String <- R.exec(["rm", "-rf", dir])
628        lay.all(dir, fs)
629    case Plan.Drop{hash}:
630      do IO<Unit>:
631        _rm : String <- R.exec(["rm", "-rf", ".ez/lib/" ++ hash])
632        return Unit{}
633    case Plan.Say{text}:
634      IO.print(text)
635    case Plan.Name{nv, hash}:
636      write(lib ++ "/names/" ++ nv, L.name.text(hash))

Uses (14)

Used by (1)