def answer
ezx@1.11.0.0 · src/tool/run.bend:123
import ezx@1.11.0.0/src/tool/run.bend as Run
import Base
import snap@1.4.0.0/main.bend as R
import ezx@1.11.0.0/src/io/file.bend as F
import ezx@1.11.0.0/src/tool/world.bend as TW
123
124def answer(ask: TW.Ask) -> IO(TW.Answer):
125 match ask:
126 case TW.Read{path}:
127 do IO<TW.Answer>:
128 m : Maybe<&2, String> <- F.read(path)
129 return TW.Plain{m}
130 case TW.Exec{path}:
131 do IO<TW.Answer>:
132 +out : String <- R.exec(["test", "-x", path])
133 return TW.Is{R.ok(out)}
134 case TW.Locate{path}:
135 locate(path)