src/tool/world.bend checks
raw source on the hub · import 0x74799d3f846634a3d7461d4336d7c9d4/src/tool/world.bend as World
tool/world: what ez tool run, install and upgrade read. The act and
the target they were given; the directory they run in (here), which a
relative cache root is taken from; the variables that place the cache and
the link (EZ_TOOL_BIN, XDG_BIN_HOME, XDG_CACHE_HOME, HOME, PATH);
the bend on the PATH, as its banner's first line; the file --entry names,
"" when it names none; the project's ledger and lock, None when there is
none; and the answers to the questions the planner (tool/plan.bend)
asked. ez tool sync reads only the ledger and the lock.
A question is a file's text, whether a binary is there, what git says of a
local path, or one of the upgrade's (lock/up.bend): Head for the commit a
remote's HEAD names, and Clone for the checkout at a rev with every
file's text. The upgrade's are answered by the lock's interpreter and kept
apart, in ups, so its lookups serve here as they are.
Everything else here is a projection: what a World says, read one way.
4 imports
import Base import ../lock/up.bend as Up import ../ledger/manifest.bend as M import ../pkg/path.bend as P
Types
type Act source · line 24 · raw
Data
what the command does with the binary once it is current: Run starts it
with these words, Install and Upgrade link it onto PATH
Run@args:List<&2, String> -> Act
InstallAct
UpgradeAct
type Env source · line 30 · raw
Data
the variables the command reads, each "" when it is unset
Env@tool_bin:String -> @xdg_bin:String -> @xdg_cache:String -> @home:String -> @path:String -> Env
type Ask source · line 34 · raw
Data
a question the planner asks that is not git's about a remote
Read@path:String -> Ask
Exec@path:String -> Ask
Locate@path:String -> Ask
type Answer source · line 43 · raw
Data
the answer to one: a file's text, whether a binary is there, or what git
said of a path: its real path, the top of the checkout holding it, the
commit HEAD names, and whether git status answered and what it printed.
A path that has no real path, or a question IO could not answer, is a miss.
Text@got:Maybe<&2, String> -> Answer
Is@yes:Bool -> Answer
Located@abs:String -> @top:String -> @head:String -> @ok:Bool -> @status:String -> Answer
Miss@why:String -> Answer
type Reply source · line 50 · raw
Data
one question, answered
Reply@ask:Ask -> @answer:Answer -> Reply
type World source · line 54 · raw
Data
everything ez tool run, install and upgrade read
World@act:Act -> @target:String -> @want:String -> @here:String -> @env:Env -> @bend:String -> @ledger:Maybe<&2, String> -> @lock:Maybe<&2, String> -> @replies:List<&2, Reply> -> @ups:List<&2, 0x74799d3f846634a3d7461d4336d7c9d4/src/lock/up.Reply> -> World
type Heard source · line 210 · raw
Data
an answer looked up, or none yet
Heard@answer:Answer -> Heard
OpenHeard
Definitions
def act source · line 60 · raw
@world:World -> Act
the act
def target source · line 65 · raw
@world:World -> String
the target asked for
def want source · line 70 · raw
@world:World -> String
the file --entry names, "" when it names none
def here source · line 75 · raw
@world:World -> String
the directory ez runs in
def env source · line 80 · raw
@world:World -> Env
the variables
def bend source · line 85 · raw
@world:World -> String
the bend on the PATH, "" when it did not answer
def ledger source · line 90 · raw
@world:World -> Maybe<&2, String>
the project's ez.toml, None when there is none
def lock source · line 95 · raw
@world:World -> Maybe<&2, String>
the project's ez.lock.toml, None when there is none
def replies source · line 100 · raw
@world:World -> List<&2, Reply>
every question of ours answered so far
def ups source · line 105 · raw
@world:World -> List<&2, 0x74799d3f846634a3d7461d4336d7c9d4/src/lock/up.Reply>
every one of the upgrade's questions answered so far
def env.tool_bin source · line 109 · raw
@vars:Env -> String
def env.xdg_bin source · line 113 · raw
@vars:Env -> String
def env.xdg_cache source · line 117 · raw
@vars:Env -> String
def env.home source · line 121 · raw
@vars:Env -> String
def env.path source · line 125 · raw
@vars:Env -> String
def home source · line 130 · raw
@world:World -> String
HOME
def bin.home source · line 137 · raw
@+home:String -> Maybe<&2, String>
~/.local/bin, when there is a HOME
def bin.xdg source · line 141 · raw
@+xdg:String -> @+home:String -> Maybe<&2, String>
$XDG_BIN_HOME when it is set, otherwise the one above
def bin.dir source · line 147 · raw
@+ez:String -> @+xdg:String -> @+home:String -> Maybe<&2, String>
where an installed command is linked: $EZ_TOOL_BIN when it is set,
otherwise $XDG_BIN_HOME, otherwise $HOME/.local/bin, an empty value
counting as unset; None when all three are empty (EZ-TOOL-1)
def bin.of source · line 151 · raw
@vars:Env -> Maybe<&2, String>
the link directory of a World's variables
def cache.home source · line 158 · raw
@+here:String -> @+home:String -> Maybe<&2, String>
the cache root: $XDG_CACHE_HOME/ez/tool, otherwise $HOME/.cache/ez/tool,
taken from where ez runs when it is relative, so every path the plan names
is absolute; None when neither variable is set
def cache.dir source · line 162 · raw
@+here:String -> @+xdg:String -> @+home:String -> Maybe<&2, String>
def cache.of source · line 167 · raw
@world:World -> Maybe<&2, String>
the cache root of a World
def text.or source · line 173 · raw
@got:Maybe<&2, String> -> String
a Maybe's text, "" for none
def project.of source · line 185 · raw
@got:Maybe<&2, String> -> 0x74799d3f846634a3d7461d4336d7c9d4/src/ledger/manifest.Read
the project's ledger as read. A project with no ez.toml pins nothing, so every target is a free one; one that does not parse is its own refusal.
def project source · line 193 · raw
@world:World -> 0x74799d3f846634a3d7461d4336d7c9d4/src/ledger/manifest.Read
the project's ledger as read
def key source · line 200 · raw
@ask:Ask -> String
the key a question is looked up by
def look.step source · line 215 · raw
@hit:Bool -> @answer:Answer -> @rest:(@_:Unit -> Heard) -> Heard
this answer when it is the question's, otherwise the rest's
def look source · line 223 · raw
@rs:List<&2, Reply> -> @+want:String -> Heard
the first answer given to a question
def heard source · line 231 · raw
@+world:World -> @ask:Ask -> Heard
the answer to a question, or none yet