Route help and version through the reporter

This commit is contained in:
2026-10-26 03:02:08 +00:00
parent 49a10690c6
commit 7a1067d387
5 changed files with 146 additions and 83 deletions

View File

@@ -166,7 +166,7 @@ func (current *execution) renderHelp(path []string) Outcome {
}
session := current.presentationSession()
view := current.app.helpView(current.route, current.snapshot)
return current.app.renderHelpViewOutcomeWithSession(view, current.streams, session)
return current.app.renderHelpViewOutcomeWithSession(view, current.reporter, session)
}
func (current *execution) renderHelpTargets(targets []string) Outcome {
@@ -184,7 +184,8 @@ func (current *execution) renderHelpTargets(targets []string) Outcome {
// Discovery routes have no canonical path and retain only trailing options.
if route.kind == routeUnknown || len(route.args) != len(route.canonicalPath) {
session := internalcobra.Prepare(snapshot.metadata, current.options)
return current.app.renderHelpOutcomeWithSession(targets, current.streams, session)
view := commandmeta.HelpView{EnteredPath: targets, CanonicalPath: targets}
return current.app.renderHelpViewOutcomeWithSession(view, current.reporter, session)
}
options := current.options
switch route.kind {
@@ -195,7 +196,7 @@ func (current *execution) renderHelpTargets(targets []string) Outcome {
}
session := internalcobra.Prepare(snapshot.metadata, options)
view := current.app.helpView(route, snapshot)
return current.app.renderHelpViewOutcomeWithSession(view, current.streams, session)
return current.app.renderHelpViewOutcomeWithSession(view, current.reporter, session)
}
func (current *execution) usageLine(path []string) string {