Cache immutable command bridge metadata

This commit is contained in:
2026-10-09 01:34:24 +00:00
parent 5816dd3eb9
commit 3ad355927c
5 changed files with 125 additions and 4 deletions

View File

@@ -17,6 +17,13 @@ func (a *App) bridgeTree() *internalcobra.Command {
if a == nil {
return nil
}
if a.commandTree == nil {
a.commandTree = a.buildBridgeTree()
}
return a.commandTree
}
func (a *App) buildBridgeTree() *internalcobra.Command {
root := &internalcobra.Command{Name: a.identity.Name}
names := make([]string, 0, len(a.commands))
for name, node := range a.commands {