Index completion metadata by canonical node
This commit is contained in:
@@ -99,13 +99,13 @@ func (a *App) buildRoutingSnapshot() *routingSnapshot {
|
||||
sort.Strings(names)
|
||||
var key commandmeta.Key
|
||||
for _, name := range names {
|
||||
root.Children = append(root.Children, bridgeCommand(a.commands[name].command, snapshot, &key))
|
||||
root.Children = append(root.Children, bridgeCommand(snapshot.canonical[name], snapshot, &key))
|
||||
}
|
||||
return snapshot
|
||||
}
|
||||
|
||||
func bridgeCommand(command Command, snapshot *routingSnapshot, next *commandmeta.Key) *commandmeta.Command {
|
||||
record := command.record
|
||||
func bridgeCommand(node *canonicalNode, snapshot *routingSnapshot, next *commandmeta.Key) *commandmeta.Command {
|
||||
record := node.command.record
|
||||
*next = *next + 1
|
||||
declaration := &commandmeta.Command{
|
||||
Key: *next,
|
||||
@@ -114,6 +114,7 @@ func bridgeCommand(command Command, snapshot *routingSnapshot, next *commandmeta
|
||||
Description: record.description,
|
||||
CoreFlags: commandmeta.ReportingFlags(),
|
||||
}
|
||||
node.metadata = declaration
|
||||
if record.payload != nil {
|
||||
snapshot.runners[declaration.Key] = record.payload
|
||||
declaration.Runnable = record.payload.hasRun()
|
||||
@@ -126,7 +127,7 @@ func bridgeCommand(command Command, snapshot *routingSnapshot, next *commandmeta
|
||||
if child.record == nil || child.record.absent {
|
||||
continue
|
||||
}
|
||||
declaration.Children = append(declaration.Children, bridgeCommand(child, snapshot, next))
|
||||
declaration.Children = append(declaration.Children, bridgeCommand(node.children[child.record.name], snapshot, next))
|
||||
}
|
||||
return declaration
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user