~/bend-docscommunity

src/ez/cmd.bend relies on unsafe/foreign

raw source on the hub · import ezx@1.15.0.0/src/ez/cmd.bend as Cmd

ez/cmd: what each subcommand does. Everything that touches the network or the file system goes through a process effect, because bend links no TLS and Base has neither mkdir nor readdir: snap's exec for a program whose answer ez reads, and share/pass.bend for the one ez run hands the terminal to.

17 imports
import Base
import snap@1.4.0.0/main.bend as R
import ../io/file.bend as F
import ../lock/run.bend as Run
import ../lock/plan.bend as P
import ../share/env.bend as Env
import ../share/exec.bend as Exec
import ../share/cap.bend as Cap
import ../share/args.bend as Args
import ../ez/ends.bend as E
import ../ez/start.bend as S
import ../share/pass.bend as Pass
import ../init/run.bend as InitRun
import ../remove/run.bend as RemoveRun
import ../add/run.bend as AddRun
import ../fetch/run.bend as FetchRun
import ../pub/run.bend as PubRun

Definitions

def toml source · line 24 · raw

String

the ledger's path, which is fixed

def started source · line 30 · raw

@+ask:0x54c6454e798d1d497bdd6d0af3a8ac92/src/ez/start.Ask -> IO(0x54c6454e798d1d497bdd6d0af3a8ac92/src/ez/start.Start)

what ez check, ez build or ez run does, decided from ez.toml as it is on disk (S.start): a missing or unreadable ledger is refused before anything is started or made

def refused source · line 36 · raw

@+why:String -> IO(Unit)

a refusal said, and the command ended on it with exit 1

def report.capped source · line 45 · raw

@+why:String -> @+out:String -> IO(Unit)

a build's output, printed with a word in front of it for a run the kernel ended rather than the program, and the command ended on it (E.ran): a failed build must fail the command, or a script around it learns nothing. bend prints that all terms check before it emits any C, so a build killed at the cap is otherwise indistinguishable from one that worked and wrote nothing.

def check.said source · line 62 · raw

@passed:Bool -> @entry:String -> @text:String -> IO(Unit)

a passing check says so, since bend says nothing when it is happy, and a failing one shows what bend said

def check.go source · line 71 · raw

@start:0x54c6454e798d1d497bdd6d0af3a8ac92/src/ez/start.Start -> IO(Unit)

the entry checked, and never run, once .ez is there for its JS. The entry is the word after bend on the line.

def check source · line 83 · raw

IO(Unit)

ez check

def build.go source · line 91 · raw

@start:0x54c6454e798d1d497bdd6d0af3a8ac92/src/ez/start.Start -> @+out:String -> IO(Unit)

a native binary, named after the package (S.build.out), once the directory it lands in is there. This is the one command that reaches bend's C backend, so it is the one that runs under the memory cap.

def build source · line 105 · raw

@+out:String -> IO(Unit)

ez build [out]

def run.started source · line 113 · raw

@start:0x54c6454e798d1d497bdd6d0af3a8ac92/src/ez/start.Start -> @+at:String -> IO(U32)

the program ez run starts, on ez's own stdin, stdout and stderr, with the project's BEND_LIB set for it, and the status it exited with; 0 when the run was refused, which starts none

def run.go source · line 122 · raw

@+start:0x54c6454e798d1d497bdd6d0af3a8ac92/src/ez/start.Start -> IO(Unit)

a run, and how it ends: exit 1 with the reason for a refusal, and the program's own status otherwise (S.code, laws/ExitStatusSaysFailure.bend)

def run source · line 131 · raw

@as:List<&2, String> -> IO(Unit)

ez run [args..]: the entry run by bend, which checks it first, with every word after run, as cargo run runs a project's binary

def publish source · line 140 · raw

IO(Unit)

ez publish, planned by pub/plan.bend: the entry the ledger names, sent to the hub once the tree is clean and git tracks every file of the package, and bend's answer checked against the 0x name ez computed. A ledger that is missing or does not parse is refused, and nothing is sent.

def lock.go source · line 152 · raw

@flags:0x54c6454e798d1d497bdd6d0af3a8ac92/src/lock/plan.Outcome -> @up:Bool -> @+name:String -> IO(Unit)

ez lock, plain or --upgrade, is the planner's (lock/plan.bend, lock/up.bend): a plain lock copies every pin as the ledger has it, refuses one it would have to fill, and never writes ez.toml; an upgrade moves the selected pins, writes ez.toml once, .gitignore, the rewritten imports and the lock in one plan. Either writes nothing when it refuses, and a missing ledger is refused. --package is only a filter on an upgrade. --package without --upgrade is refused before anything is read (E.lock.flags).

def lock source · line 160 · raw

@+up:Bool -> @+name:String -> IO(Unit)

ez lock and ez lock --upgrade [--package NAME]

def fetch source · line 165 · raw

IO(Unit)

ez fetch, planned by fetch/plan.bend: BEND_LIB filled from the lock, with nothing re-resolved, and nothing laid unless every package checks

def init source · line 170 · raw

@+asked:String -> @+file:String -> @+desc:String -> IO(Unit)

ez init [name] [entry.bend] [--description TEXT]: a new project, planned by init/plan.bend

def add source · line 178 · raw

@+target:String -> @+ref:String -> @+entry:String -> @+rename:String -> IO(Unit)

ez add <target> [rev|tag|branch] [entry.bend] [--rename NAME], planned by add/plan.bend. The target is an owner/repo, a git url, or a path, the same shapes ez tool run takes, or a hub package's <name>@<version> (add/hub.bend). A missing ref is resolved, and a missing entry is read from the checkout, or from the package the hub serves.

def remove source · line 182 · raw

@+name:String -> IO(Unit)

ez remove <name>, planned by remove/plan.bend