1 # init/run: the interpreter for `ez init`. It reads ez.toml, `.gitignore`, 2 # the entry file and `src/lib.bend` into a World, asks the planner 3 # (init/plan.bend) for the plan, and runs it with the lock's effect runner 4 # (`Run.exec.plan`), which makes a file's directory before writing it and 5 # exits 1 with the reason when the plan refuses. It decides nothing; that it 6 # reads and executes faithfully is EZ-TRUST-2. 7 import Base 8 import ../io/file.bend as F 9 import ../lock/run.bend as Run 10 import ./plan.bend as IP 11 12 # `ez init [name] [entry.bend] [--description TEXT]` 13 def run(+name: String, +file: String, +desc: String) -> IO(Unit): 14 do IO: 15 lib : String <- Run.bend.lib() 16 led : Maybe<&2, String> <- F.read(IP.toml()) 17 ig : Maybe<&2, String> <- F.read(IP.ignore.file()) 18 mn : Maybe<&2, String> <- F.read(IP.entry.or(file)) 19 lb : Maybe<&2, String> <- F.read(IP.lib.file()) 20 Run.exec.plan(lib, IP.plan(IP.World{name, file, desc, led, ig, mn, lb}))