src/ez/start.bend checks
raw source on the hub · import ezx@1.18.0.0/src/ez/start.bend as Start
ez/start: what ez check, ez build and ez run start, decided from the
ledger they read and the words they were given. Each starts one bend on
the entry the ledger names, or refuses and starts nothing when there is no
ez.toml or it does not parse, as cargo refuses a directory with no
Cargo.toml. The interpreter (ez/cmd.bend) reads ez.toml, puts the
project's BEND_LIB in front of the line (Env.line), runs it and exits;
that it does so faithfully is trusted in ez/app.bend.
3 imports
import Base import ../ledger/manifest.bend as M import ../share/args.bend as Args
Types
type Ask source · line 14 · raw
Data
which of the three commands is asking, with what it was told: where a build goes, and every word of the line for a run
CheckAsk
Build@out:String -> Ask
Run@as:List<&2, String> -> Ask
type Start source · line 21 · raw
Data
what a command does: refuse with a reason, having started nothing, or start bend with this line
Refused@why:String -> Start
Starts@line:List<&2, String> -> Start
Definitions
def does source · line 26 · raw
@ask:Ask -> String
what each command is for, in the words a refusal says it with
def toml source · line 36 · raw
String
the ledger's path, which is fixed
def none source · line 40 · raw
@ask:Ask -> String
why a directory with no ez.toml is refused
def entry.or source · line 44 · raw
@+file:String -> String
the entry file a ledger names, or "main.bend" when it names none
def entry source · line 48 · raw
@ledger:0x2414c9622cab2353684d02a392804eb1/src/ledger/manifest.Manifest -> String
the entry file of a ledger that parsed
def named source · line 53 · raw
@ledger:0x2414c9622cab2353684d02a392804eb1/src/ledger/manifest.Manifest -> String
the name a ledger that parsed gives the package
def build.named source · line 61 · raw
@+name:String -> String
where a build lands when nothing said: bin/<package name>.out. The name
and not the entry file, because the entry is where a program starts and the
name is what it is called: a package named bolt with its entry at
bolt/main.bend builds bin/bolt.out and not bin/main.out.
def build.out source · line 65 · raw
@+at:String -> @+name:String -> String
where a build lands: what was asked for, or the default
def line source · line 71 · raw
@ask:Ask -> @+ledger:0x2414c9622cab2353684d02a392804eb1/src/ledger/manifest.Manifest -> List<&2, String>
the line each command starts bend with, over a ledger that parsed: the
entry checked into .ez/check.js and never run, built to a native binary,
or run with every word after run (laws/RunPassesWords.bend)
def read source · line 81 · raw
@+ask:Ask -> @ledger:0x2414c9622cab2353684d02a392804eb1/src/ledger/manifest.Read -> Start
what a command does with the ledger it read
def start source · line 89 · raw
@+ask:Ask -> @text:Maybe<&2, String> -> Start
what a command does with ez.toml's text, None when there is none
def code source · line 100 · raw
@start:Start -> @program:U32 -> U32
the status ez run exits with, given the status of the program it started
(laws/ExitStatusSaysFailure.bend): 1 for a refusal, which started none,
and the program's own status otherwise, as cargo run exits. ez check
and ez build end on what bend printed instead (ez/ends.bend).
def why source · line 108 · raw
@start:Start -> String
why a command refused, or "" when it started bend