Discover help routes through intermediate aliases

This commit is contained in:
2026-10-20 01:03:54 +00:00
parent 4ddf960836
commit bafd365115
5 changed files with 121 additions and 59 deletions

View File

@@ -133,6 +133,20 @@ func (resolver *Resolver) Resolve(path commandpath.Path) commandpath.Path {
}
}
// ResolutionPaths returns the entered path and each path produced by a
// longest-prefix rewrite. It supports metadata discovery along alias chains.
// Installation validates termination before this method is used.
func (resolver *Resolver) ResolutionPaths(path commandpath.Path) []commandpath.Path {
paths := []commandpath.Path{path.Clone()}
for {
next, _, matched := resolver.ResolveOnce(paths[len(paths)-1])
if !matched {
return paths
}
paths = append(paths, next)
}
}
// ResolveWithProvenance resolves a command path and carries the input token
// indexes that contributed to each output component. Rewritten target
// components inherit the origins of the matched source prefix.