1 # ezx: ez's ledger library for Bend 2: it parses an ez.toml into its package, dependencies and pinned tools. 2 # 3 # main: the library's entry, which the hub publishes as ezx. It names the 4 # reading ledger/manifest.bend does, one def each, so a program can read a 5 # ledger by importing this file alone; the types the answers come in are 6 # ledger/manifest.bend's, and a program that takes one apart imports that 7 # file too. It sits at the top of the repo so the LICENSE beside it goes 8 # along with the package. The ez binary is ez/main.bend, which ez.toml names 9 # as `bin`. 10 import Base 11 import ./ledger/manifest.bend as M 12 13 # an ez.toml's text read as a ledger, or why it could not be 14 def parse(text: String) -> M.Read: 15 M.parse(text) 16 17 # a ledger, or the error, on one line 18 def show(ledger: M.Read) -> String: 19 M.show(ledger) 20 21 # the named dependency of a ledger, or one with empty fields 22 def dep(ledger: M.Read, name: String) -> M.Dep: 23 M.dep(ledger, name) 24 25 # a dependency's own name 26 def dep.name(dependency: M.Dep) -> String: 27 M.dep.name(dependency) 28 29 # a dependency's hash, the `0x` name its import line carries 30 def dep.hash(dependency: M.Dep) -> String: 31 M.dep.hash(dependency) 32 33 # the file inside the package a dependency was added by 34 def dep.entry(dependency: M.Dep) -> String: 35 M.dep.entry(dependency) 36 37 # where a dependency's bytes come from 38 def dep.source(dependency: M.Dep) -> M.Source: 39 M.source.dep(dependency) 40 41 # the commit a source is pinned to, or "" for a hub package 42 def source.rev(src: M.Source) -> String: 43 M.source.rev(src) 44 45 # the tag a source was asked for, or "" when it was pinned by commit 46 def source.tag(src: M.Source) -> String: 47 M.source.tag(src) 48 49 # the repo a source is taken from, or "" for a hub package 50 def source.url(src: M.Source) -> String: 51 M.source.url(src) 52 53 # the `@` a hub source was added by, or "" 54 def source.nv(src: M.Source) -> String: 55 M.source.nv(src) 56 57 # whether a source names a repo rather than the hub 58 def source.is_git(src: M.Source) -> Bool: 59 M.source.is_git(src) 60 61 # the commit the named dependency is pinned to 62 def rev_of(ledger: M.Read, name: String) -> String: 63 M.rev_of(ledger, name) 64 65 # the tag the named dependency was asked for 66 def tag_of(ledger: M.Read, name: String) -> String: 67 M.tag_of(ledger, name) 68 69 # the hub a ledger's packages come from 70 def hub_of(ledger: M.Read) -> String: 71 M.hub_of(ledger) 72 73 # the pinned CLIs of a ledger 74 def tools_of(ledger: M.Read) -> List<&2, M.Tool>: 75 M.tools_of(ledger) 76 77 # a tool's own name 78 def tool.name(pin: M.Tool) -> String: 79 M.tool.name(pin)