Documentation
¶
Overview ¶
Package ref looks up 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 name derives. Without a prefix only an explicit reference is accepted, 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 looked-up 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 Match ¶ added in v0.33.0
Match is the task id in text: a branch name, a PR title, a commit subject. It is fromBranch minus git, so standup reads titles and subjects by the same rule and a test needs no checkout.
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 Lookup ¶ added in v0.26.0
type Lookup 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 Lookup answers references for one checkout.
func (Lookup) Find ¶ added in v0.26.0
Find 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.