~/bend-docscommunity

src/ez/named.bend checks

raw source on the hub · import 0x886223f5c47e4983fe57d887c034bc7f/src/ez/named.bend as Named

ez/named: the name ez add records a dependency under, in the order cargo names one. A source the ledger already holds keeps the name the ledger gave it. Otherwise a package that is an ez project is named by its own [package] name, when that is a TOML bare key; otherwise a repository by its own name, and a directory by the directory's. The entry file names nothing, because most packages call theirs main.bend, and two of them would share one [deps.main]. A name the ledger gives to another source is refused rather than written over.

4 imports
import Base
import ../ledger/manifest.bend as M
import ../ez/target.bend as Tgt
import ../pkg/pkg.bend as K

Types

type Seen source · line 16 · raw

Data

a text walked from its end: whether a slash has been passed yet, and what lies after the last one

Definitions

def last.at source · line 20 · raw

@slash:Bool -> @ch:Char -> @rest:String -> Seen

one char in front of what was seen, when no slash has been passed yet

def last.step source · line 29 · raw

@+ch:Char -> @seen:Seen -> Seen

one char in front of what was seen. Once a slash has been passed, nothing further left changes the answer.

def last source · line 38 · raw

@text:String -> Seen

the text after its last slash, and whether it had one

def leaf.of source · line 46 · raw

@seen:Seen -> String

what lies after the last slash

def leaf source · line 51 · raw

@text:String -> String

the last component of a path, a slug or a url

def called source · line 57 · raw

@place:0x886223f5c47e4983fe57d887c034bc7f/src/ez/target.Place -> @+url:String -> String

the name a source gives itself. A remote is its slug's last component, which is the repository with any .git already off; a path is the last component of the directory it was resolved to.

def bare.step source · line 68 · raw

@ok:Bool -> @rest:(@_:Unit -> Bool) -> Bool

one char of a key, with the rest still to be asked about. The rest arrives as a thunk, so a char that ends the key ends the walk.

def bare.rest source · line 76 · raw

@text:String -> Bool

the rest of a TOML bare key: letters, digits, - and _

def bare source · line 85 · raw

@text:String -> Bool

a TOML bare key: at least one char, each a letter, a digit, - or _. Only such a name can stand in [deps.<name>] unquoted.

def from source · line 93 · raw

@src:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Source -> @+url:String -> Bool

whether a source is this git url

def had.at source · line 101 · raw

@same:Bool -> @name:String -> @rest:String -> String

a dependency's name when it is this source, or the answer further on

def had source · line 111 · raw

@ds:List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep> -> @+url:String -> @fresh:String -> String

the name the ledger already gives this url, first in document order, or the fresh one when it gives none. A re-add is then the same entry, whatever the ledger called it.

def own source · line 121 · raw

@+pkg:String -> @+fresh:String -> String

the package's own name when it is a bare key, or the name its source gives it. A name that could not stand as a key falls through, not refused.

def name source · line 126 · raw

@ds:List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep> -> @+url:String -> @+pkg:String -> @+fresh:String -> String

the name a dependency is recorded under: the ledger's for this source, else the package's own, else its source's

def clash.at source · line 130 · raw

@hit:Bool -> @src:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Source -> @+url:String -> @rest:Bool -> Bool

the first dependency of this name, asked whether it is another source

def clash source · line 139 · raw

@ds:List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep> -> @+name:String -> @+url:String -> Bool

whether the ledger gives this name to a source other than this url. A hub dependency of the name is another source too.

def why source · line 148 · raw

@ds:List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep> -> @+name:String -> @+url:String -> String

why a name cannot be recorded, or nothing when it can

def as source · line 158 · raw

@ds:List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep> -> @+url:String -> @+rename:String -> @+pkg:String -> @+fresh:String -> String

--rename, the way cargo add --rename works: when it is given, it is the name, ahead of every rule above

def renamed.ok source · line 163 · raw

@+rename:String -> Bool

a --rename that can stand as a key, or none at all

def moved.of source · line 168 · raw

@+old:String -> @+rename:String -> Bool

whether a --rename gives a second name to a source the ledger already records as old, "" when it records none

def moved source · line 174 · raw

@ds:List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep> -> @+url:String -> @+rename:String -> Bool

whether a --rename would record a source the ledger already names under a second name. That is refused rather than duplicated or silently renamed.

def why.as source · line 179 · raw

@+ds:List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep> -> @+name:String -> @+url:String -> @+rename:String -> String

why a name cannot be recorded when --rename may have been given, or nothing when it can

def hub.part source · line 195 · raw

@+nv:String -> String

the name part of a <name>@<version>, what comes before its @. It is a-z, 0-9 and -, so it is a TOML bare key as it is.

def hub.from source · line 200 · raw

@src:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Source -> @+part:String -> Bool

whether a source is a hub package added by a name with this name part, whatever its version

def hub.had source · line 210 · raw

@ds:List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep> -> @+part:String -> String

the name the ledger already gives a hub package of this name part, first in document order, or "" when it gives none. Adding another version of a name is then the same entry, as re-adding a git dependency at a new tag is.

def hub.key source · line 220 · raw

@ds:List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep> -> @+part:String -> @+rename:String -> String

the name a hub package is recorded under: --rename when it is given, else the ledger's for this name part, else the name part itself

def hub.clash.at source · line 226 · raw

@hit:Bool -> @src:0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Source -> @+part:String -> @rest:Bool -> Bool

the first dependency of this name, asked whether it is another source

def hub.clash source · line 235 · raw

@ds:List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep> -> @+name:String -> @+part:String -> Bool

whether the ledger gives this name to anything but a hub package of this name part: a git dependency, or one added by its hash

def hub.why source · line 246 · raw

@+ds:List<&2, 0x886223f5c47e4983fe57d887c034bc7f/src/ledger/manifest.Dep> -> @+name:String -> @+part:String -> @+rename:String -> String

why a hub package cannot be recorded under a name, or nothing when it can: a --rename that is no key, a --rename of a name part the ledger records under another name, or a name the ledger gives another source