Documentation
¶
Overview ¶
Package ref resolves which task a lookaround command is about. Every noun takes the same optional reference and falls back the same way, so the cascade lives here once: an explicit id, then the id in the current branch name, then the task this session's f10-state file records.
The prefix that makes a branch searchable comes from facts - the task id format a project declares, or the one its host implies. Without a prefix only an explicit reference resolves, because no rule can tell a task number in a branch name from any other number.
Index ¶
Constants ¶
const ( OriginExplicit = "explicit" OriginBranch = "branch" OriginSession = "session" )
Where a resolved reference came from. Reported so an error, or a caller that wants to say "GH-22, from the branch", can name it.
Variables ¶
var ErrNoReference = errors.New("no task reference given")
ErrNoReference means the cascade ran out. It is wrapped with what each tier actually had to offer, because "none found" alone sends a reader looking in the wrong place - most often at a session tier that was never available to them.
Functions ¶
func SplitSuffix ¶
SplitSuffix separates a salted reference into the reference and its suffix. A token without one, or a url, comes back whole with "".
Types ¶
type Ref ¶
type Ref struct {
ID string // "GH-22": the prefix and number in the project's format
Number string // "22": what a host CLI wants
Origin string
}
A Ref is one resolved task reference.
type Resolver ¶
type Resolver struct {
Prefix string // id prefix from facts ("ABC", "GH"); empty where nothing declares or implies one
Dir string // checkout root - the branch is read from here
}
A Resolver answers references for one checkout.
func (Resolver) Resolve ¶
Resolve walks the cascade. An empty explicit reference falls through to the branch and then to the session; a non-empty one that does not parse is an error rather than a fallthrough, because a typo'd id should say so instead of quietly opening whatever the branch happens to name.