Retain discovery prefixes in usage diagnostics

This commit is contained in:
2026-10-20 01:04:56 +00:00
parent bafd365115
commit 5c26d80228
3 changed files with 67 additions and 2 deletions

View File

@@ -194,7 +194,13 @@ func (current *execution) usageLine(path []string) string {
func (current *execution) present(outcome Outcome, path []string) Outcome {
usageLine := func(path []string) string { return current.usageLine(path) }
if current.route.kind == routeCanonical && !current.route.enteredPath.Equal(current.route.canonicalPath) {
switch {
case current.route.kind == routeDiscovery:
path = clonePath(current.route.enteredPath)
usageLine = func([]string) string {
return fmt.Sprintf("Usage: %s %s [command]", current.app.identity.Name, current.route.enteredPath.String())
}
case current.route.kind == routeCanonical && !current.route.enteredPath.Equal(current.route.canonicalPath):
path = clonePath(current.route.enteredPath)
usageLine = func([]string) string { return current.routeUsageLine() }
}