src/ez/app.bend relies on unsafe/foreign
raw source on the hub · import ezx@1.16.0.0/src/ez/app.bend as MApp
ez: the one binary. The line is a Shake.Cli (L.spec): parse binds the
command and its flags, and get / on read the bindings. How a line ends
is decided in ez/line.bend (L.line, L.status): a command runs, help is
shown and the line exits 0, or the line is misused and exits 1. This file
prints and exits as they say and runs the command, which is trusted
(below). IO.args() is copied so each word can be read more than once.
The repo's top-level main.bend calls this main, and is the file that gets
built. Build it native (bend main.bend -o bin/ez.bin); interpreted, bend's
own CLI would take the flags meant for ez.
Trusted, not proved: the interpreters (this file, ez/cmd.bend and each
command's run.bend) read the World and execute plans faithfully, and exit
with the status the planners' ends give. They make no decisions and are
kept small enough to review line by line; every decision is a planner's,
where the laws reach it. A failure an interpreter meets itself, a write
the system rejects, a build or link that fails, a fetch inside ez tool,
or a loop that runs out of fuel, exits 1. The words they are handed are
trusted in share/args.bend.
13 imports
import Base import shake@0.6.0.0/main.bend as Shake import ../share/args.bend as Args import ./cmd.bend as Cmd import ./test.bend as Test import ./prove.bend as Prove import ../doctor/run.bend as DoctorRun import ../tool/run.bend as ToolRun import ../tool/world.bend as TW import ../share/say.bend as Say import ../io/file.bend as F import ../ez/line.bend as L import ../ws/run.bend as WsRun
Definitions
def dispatch source · line 38 · raw
@sub:0x71927e9fe3c5d91fa7a64d2340a0fdac/src/ez/line.Sub -> @+matched:0xa383b26a5a0ef35663b3615d7aedf9e3/main.Matched -> @+as:List<&2, String> -> IO(Unit)
what a subcommand runs. L.line never runs CHelp, which names no
command; it is here so the match is whole, and it writes the help a bare
ez would. The directories ez check and ez build write into are made
by those commands once they know they will start bend (Env.dirs), so a
refused one leaves the directory as it found it.
def hint.sync source · line 87 · raw
@is_sync:Bool -> IO(Unit)
sync with no tools is lock or install; a ledger that pins tools already
names the command that builds them. Anything else is the parser's own error.
def go.say source · line 98 · raw
@how:0x71927e9fe3c5d91fa7a64d2340a0fdac/src/ez/line.Line -> @+as:List<&2, String> -> IO(Unit)
what a line says: the command it names run, its help on stdout, or what
was wrong with it on stderr, with a hint for ez sync
def go.exit source · line 110 · raw
@zero:Bool -> @+code:U32 -> IO(Unit)
a status that is 0 ends nothing, and any other exits with it
def go.end source · line 119 · raw
@st:0x71927e9fe3c5d91fa7a64d2340a0fdac/src/ez/line.Status -> IO(Unit)
a status decided before any command ran, exited with; a command's own end is its own
def go.line source · line 127 · raw
@+how:0x71927e9fe3c5d91fa7a64d2340a0fdac/src/ez/line.Line -> @+as:List<&2, String> -> IO(Unit)
how the line ends, as L.line decided, and the status L.status gives it
def go source · line 133 · raw
@+app:0xa383b26a5a0ef35663b3615d7aedf9e3/main.Cli -> @+as:List<&2, String> -> IO(Unit)
the line taken apart
def main source · line 136 · raw
IO(Unit)