src/ledger/render.bend checks
raw source on the hub · import ezx@1.17.0.0/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:0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Source -> String
the keys a source contributes
def dep source · line 41 · raw
@dependency:0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Dep -> String
one [deps.<name>] section
def deps source · line 46 · raw
@ds:List<&2, 0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Dep> -> String
every dependency, in the order the ledger holds them
def tool source · line 54 · raw
@pin:0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Cli -> String
one [tools.<name>] section. No hash: a tool is not a package.
def tools source · line 59 · raw
@ts:List<&2, 0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Cli> -> String
every pinned CLI, in the order the ledger holds them
def text source · line 67 · raw
@manifest:0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Manifest -> String
the ledger as ez assembles it, in the TOML ez wrote before eztoml 0.4
def show source · line 74 · raw
@manifest:0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Manifest -> String
the ledger as an ez.toml: ez's text, written as eztoml writes it
def render source · line 79 · raw
@ledger:0x9b437420348c999bf7a583a0fe7a67f5/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 87 · raw
@hit:Bool -> @dependency:0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Dep -> @rest:List<&2, 0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Dep> -> List<&2, 0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Dep>
a dependency kept or dropped
def without source · line 95 · raw
@ds:List<&2, 0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Dep> -> @+name:String -> List<&2, 0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Dep>
every dependency but the one named
def add source · line 104 · raw
@manifest:0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Manifest -> @+dependency:0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Dep -> 0x9b437420348c999bf7a583a0fe7a67f5/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 109 · raw
@manifest:0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Manifest -> @name:String -> 0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Manifest
the ledger with a dependency dropped
def vendored source · line 114 · raw
@src:0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Source -> 0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Source
a git source with its tree committed
def revend source · line 124 · raw
@keep:Bool -> @src:0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Source -> 0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Source
a source that keeps a vendor bit the ledger already set, or is left as given
def readd source · line 134 · raw
@ds:List<&2, 0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Dep> -> @dependency:0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Dep -> 0x9b437420348c999bf7a583a0fe7a67f5/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 140 · raw
@manifest:0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Manifest -> @dependency:0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Dep -> 0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Manifest
the ledger with a dependency added, keeping the vendor bit of the entry it replaces
def clear source · line 148 · raw
@text:String -> @+ch:Char -> Bool
whether a text holds no copy of a char
def clean source · line 160 · 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 168 · raw
@src:0x9b437420348c999bf7a583a0fe7a67f5/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.
A workspace member's is workspace = true, with the directory and the name
only the joint ledger gives it.
def hash.ok source · line 182 · raw
@src:0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Source -> @+hash:String -> Bool
whether a dependency's hash can be written: one is there, which the reader asks every dependency for but a workspace member's, whose ledger records none and whose hash only the joint ledger gives
def dep.ok source · line 193 · raw
@dependency:0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Dep -> Bool
whether a dependency does: it has a hash, but for a workspace member, and every name and value is clean
def deps.ok source · line 199 · raw
@ds:List<&2, 0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Dep> -> Bool
whether every dependency does
def tool.src.ok source · line 210 · raw
@src:0x9b437420348c999bf7a583a0fe7a67f5/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 220 · raw
@pin:0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Cli -> Bool
whether a pinned CLI does
def tools.ok source · line 225 · raw
@ts:List<&2, 0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Cli> -> Bool
whether every pinned CLI does
def renderable source · line 239 · raw
@manifest:0x9b437420348c999bf7a583a0fe7a67f5/src/ledger/manifest.Manifest -> Bool
whether a ledger can be written so that it reads back as itself
(laws/WrittenLedgerReadsBack.bend): 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 245 · raw
String
why a ledger that is not renderable is not written