src/ledger/render.bend checks
raw source on the hub · import 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/render.bend as Render
ledger/render: a ledger written back out as ez.toml, and the two edits the command line makes to it. Rendering is from the model, so the file it writes is the file it would read back.
3 imports
import Base import ./manifest.bend as M import ../toml/toml.bend as T
Definitions
def line source · line 10 · raw
@key:String -> @+val:String -> String
a key line, or nothing at all when the value is empty, so an absent tag, entry or bin leaves no trace
def line.bare source · line 15 · raw
@key:String -> @+val:String -> String
a key line whose value is written bare, as a TOML boolean is, or nothing at all when the value is empty
def vendor.word source · line 22 · raw
@vend:Bool -> String
true when the tree is committed, and nothing when it is not, so the key
is absent rather than written as an empty string. It is written bare: in
TOML vendor = "true" is a string, and a reader other than ez, such as
nix's builtins.fromTOML, would take it for one. ez reads both spellings.
def source source · line 30 · raw
@src:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Source -> String
the keys a source contributes
def dep source · line 39 · raw
@dependency:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep -> String
one [deps.<name>] section
def deps source · line 44 · raw
@ds:List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep> -> String
every dependency, in the order the ledger holds them
def tool source · line 52 · raw
@pin:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Tool -> String
one [tools.<name>] section. No hash: a tool is not a package.
def tools source · line 57 · raw
@ts:List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Tool> -> String
every pinned CLI, in the order the ledger holds them
def text source · line 65 · raw
@manifest:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Manifest -> String
the ledger as ez assembles it, in the TOML ez wrote before eztoml 0.4
def show source · line 72 · raw
@manifest:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Manifest -> String
the ledger as an ez.toml: ez's text, written as eztoml writes it
def render source · line 77 · raw
@ledger:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Read -> String
a ledger that was read, as an ez.toml; an unreadable one renders as nothing, so a failed read can never overwrite a good file with a guess
def without.put source · line 85 · raw
@hit:Bool -> @dependency:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep -> @rest:List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep> -> List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep>
a dependency kept or dropped
def without source · line 93 · raw
@ds:List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep> -> @+name:String -> List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep>
every dependency but the one named
def add source · line 102 · raw
@manifest:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Manifest -> @+dependency:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep -> 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Manifest
the ledger with a dependency added, replacing any of the same name, so adding twice is the same as adding once
def remove source · line 107 · raw
@manifest:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Manifest -> @name:String -> 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Manifest
the ledger with a dependency dropped
def vendored source · line 112 · raw
@src:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Source -> 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Source
a git source with its tree committed
def revend source · line 120 · raw
@keep:Bool -> @src:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Source -> 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Source
a source that keeps a vendor bit the ledger already set, or is left as given
def readd source · line 130 · raw
@ds:List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep> -> @dependency:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep -> 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep
a dependency added again keeps the vendor = true its entry already had.
The command line has no way to say it, so a re-add that dropped it would
drop the tree from the allowlist without anyone having asked.
def add.keep source · line 136 · raw
@manifest:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Manifest -> @dependency:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep -> 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Manifest
the ledger with a dependency added, keeping the vendor bit of the entry it replaces
def clear source · line 144 · raw
@text:String -> @+ch:Char -> Bool
whether a text holds no copy of a char
def clean source · line 156 · raw
@+text:String -> Bool
whether a name or value can be written as it is: it holds no ", no \
and no newline. The pinned eztoml reader (v0.1.0) neither writes nor reads
escapes, a newline would end the line, and a quote or a backslash would make
the file mean something else to every other TOML reader, nix's among them.
def source.ok source · line 162 · raw
@src:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Source -> Bool
whether a source reads back as itself. A git source names its repo and the
directory its paths are written from: the reader takes a section with no
git for a hub package and one with no root for the top of the checkout.
def dep.ok source · line 173 · raw
@dependency:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep -> Bool
whether a dependency does: it has a hash, which the reader asks every dependency for, and every name and value is clean
def deps.ok source · line 179 · raw
@ds:List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep> -> Bool
whether every dependency does
def tool.src.ok source · line 190 · raw
@src:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Source -> Bool
whether a pinned CLI's source does. A tool is never imported, so the reader keeps no hub name for one, and one written with a name would read back without it.
def tool.ok source · line 198 · raw
@pin:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Tool -> Bool
whether a pinned CLI does
def tools.ok source · line 203 · raw
@ts:List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Tool> -> Bool
whether every pinned CLI does
def renderable source · line 216 · raw
@manifest:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Manifest -> Bool
whether a ledger can be written so that it reads back as itself (EZ-LED-4):
every name and value is clean, publish-as and version among them, every
dependency has a hash, and every git source names its repo and its root.
Every command that writes ez.toml refuses a ledger that is not, so every
ledger ez writes is one of these.
def unrenderable source · line 222 · raw
String
why a ledger that is not renderable is not written