Documentation
¶
Overview ¶
Package unit names units and folders by their path from the repo's root, the one name every clone and worktree of a repo shares.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidPath = errors.New("not a path from the repo's root")
ErrInvalidPath is returned, wrapped, for a path that isn't one from the root: empty, absolute, or climbing out of it.
Functions ¶
This section is empty.
Types ¶
type Naming ¶
type Naming struct {
// From is the folder the names are read from: the run's target, or
// the folder its units share where one is outside the target.
From Path
// AboveRoot reports whether the names are read from the folder above
// the root, From, as where the root is a unit beside others: each name
// then begins with the repo's name.
AboveRoot bool
// Header are the folders every unit sits in at the same depth below
// From, taken out of each name and named once, in depth order.
Header []string
// Names are the units' names, in the order the units came.
Names []string
}
Naming is how a run names its units in views (spec 2.7.1, 2.7.3).
func Names ¶
Names names units, each at or below target unless a dependency brings it in from outside, in a repo called rootName, its identity's name, which every clone and worktree shares, never the folder a checkout sits in: a unit's name is its path from the run's target, less any folder every unit shares at the same depth, which the header names once. A unit outside the target names every unit from the folder they share instead. A name keeps at least its unit's own folder: a unit that is the folder names are read from is named by its own folder's name, the root's by rootName, and beside units inside it, names are read from the folder above, so no two names are one.
type Path ¶
type Path struct {
// contains filtered or unexported fields
}
Path is a slash path from the repo's root, clean and inside it: "." for the root itself. The zero Path is no path at all.
func ParsePath ¶
ParsePath reads a slash path from the root, cleaning it, so "./a/b/" and "a/x/../b" are both "a/b". It refuses an empty or absolute path, and one that climbs above the root.
func Shared ¶
Shared is the deepest folder at or above every path: the folder the paths share. Of no paths it's the root.
type Row ¶
type Row struct {
// Chain are the folder names the row shows: one, or a chain of
// folders each holding one folder and no unit, shown as one row.
Chain []string
// Path is the folder the row opens: the chain's last.
Path Path
// Unit reports whether Path is a unit.
Unit bool
}
Row is one row of a folder's listing in the columns (spec 2.7.2).