src/remove/plan.bend checks
raw source on the hub · import 0x886223f5c47e4983fe57d887c034bc7f/src/remove/plan.bend as Plan
remove/plan: ez remove as a pure planner. It asks nothing: its World is
the name asked for, the ledger's text (None when there is no ez.toml) and
.gitignore's text ("" when there is none), and its planner is one function
from that World to a Plan. The interpreter (remove/run.bend) reads the two
files, calls it, and runs what it returns.
The plan, when the ledger reads and names the dependency: ez.toml written
with the dependency dropped (Rend.remove); .gitignore written with the
allowlist I.sync derives from what is left, when that changes it; and
the committed tree .ez/lib/<hash> of a dependency that was vendored
removed, unless a dependency that is left still names that hash. Anything
else is a refusal, with no effect at all: no ledger, one that does not
parse, or a name the ledger does not have, which cargo remove refuses too.
The Effect, Plan and Outcome types are the lock's (lock/plan.bend), which the add design moves to a shared plan/plan.bend later; see "Update (A1, A4)" in docs/rfc/ez-add-planner.md.
5 imports
import Base import ../lock/plan.bend as P import ../ledger/manifest.bend as M import ../ledger/render.bend as Rend import ../ledger/ignore.bend as I
Types
type World source · line 26 · raw
Data
what ez remove reads: the name it was given, the ledger's text or None,
and the ignore file's text, "" when there is none
World@name:String -> @ledger:Maybe<&2, String> -> @ignore:String -> World
Definitions
def toml source · line 30 · raw
String
the ledger's path, which is fixed
def ignore.file source · line 34 · raw
String
the ignore file's path, which is fixed
def read.of source · line 39 · raw
@got:Maybe<&2, String> -> 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Read
the ledger as read: what the file says, or, with no file, a read that did not parse and says why. A missing ledger is not an empty one to write back.
def deps.of source · line 48 · raw
@manifest:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Manifest -> List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep>
the dependencies of a ledger that was read
def any.step source · line 53 · raw
@hit:Bool -> @rest:(@_:Unit -> Bool) -> Bool
the rest of a scan only when this one was not it
def named source · line 61 · raw
@ds:List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep> -> @+name:String -> Bool
whether a dependency has this name
def holds source · line 69 · raw
@ds:List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep> -> @+hash:String -> Bool
whether a dependency names this hash
def char.ok source · line 77 · raw
@+ch:Char -> Bool
whether a char may stand in a hash that names a directory under .ez/lib
def chars.ok source · line 81 · raw
@text:String -> Bool
whether every char of a text may
def safe source · line 92 · raw
@+hash:String -> Bool
a hash rm -rf .ez/lib/<hash> removes one tree for: a 0x name with no
path separator in it. M.parse does not check a hash's shape, and a ledger
is text a person edits, so this is checked before a tree is removed.
def gone.hash source · line 97 · raw
@keep:Bool -> @+hash:String -> @rest:List<&2, String> -> List<&2, String>
a vendored hash, removed ahead of the rest when it is safe to remove and no dependency that is left names it
def gone.put source · line 105 · raw
@hit:Bool -> @+hash:String -> @+left:List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep> -> @rest:List<&2, String> -> List<&2, String>
a dependency's committed tree, when it is the one removed and is vendored
def gone source · line 114 · raw
@ds:List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep> -> @+name:String -> @+left:List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep> -> List<&2, String>
the committed trees removing name leaves no dependency to name: the hash
of each vendored dependency by that name that none in left names
def ignore.put source · line 123 · raw
@same:Bool -> @+next:String -> @rest:List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/lock/plan.Effect> -> List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/lock/plan.Effect>
.gitignore written ahead of the rest when the allowlist changes it
def edits source · line 133 · raw
@+led:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Manifest -> @+name:String -> @+ignore:String -> List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/lock/plan.Effect>
what ez remove does to a ledger that names the dependency: the ledger
written without it, the allowlist derived from what is left, and each
committed tree it leaves unnamed removed
def absent source · line 141 · raw
@+name:String -> String
the refusal for a name the ledger does not have
def refusal source · line 147 · raw
@named:Bool -> @+name:String -> String
the refusal for a ledger that names the dependency but, with it dropped, cannot be written so that it reads back (EZ-LED-4), or for a name it does not have
def plan.has source · line 152 · raw
@has:Bool -> @+led:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Manifest -> @+name:String -> @+ignore:String -> 0x886223f5c47e4983fe57d887c034bc7f/src/lock/plan.Plan
the plan for a ledger that read: the edits when it names the dependency and the ledger left can be written, a refusal when not
def plan.read source · line 162 · raw
@led:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Read -> @+name:String -> @+ignore:String -> 0x886223f5c47e4983fe57d887c034bc7f/src/lock/plan.Plan
the plan for the ledger as read. One that did not read, or is not there, is refused before anything else, and its reason is the one every command that edits a ledger gives.
def plan source · line 171 · raw
@world:World -> 0x886223f5c47e4983fe57d887c034bc7f/src/lock/plan.Plan
ez remove over a World
def refuses.plan source · line 176 · raw
@pl:0x886223f5c47e4983fe57d887c034bc7f/src/lock/plan.Plan -> Bool
whether a plan ends in a refusal
def refuses source · line 185 · raw
@world:World -> Bool
whether ez remove refuses on a World
def after source · line 189 · raw
@wrote:0x886223f5c47e4983fe57d887c034bc7f/src/lock/plan.Wrote -> @+was:String -> String
what a path holds once a plan has run, when it held was before