Include available choices in unknown scope diagnostics

This commit is contained in:
2026-10-07 16:50:23 +00:00
parent d5f544d14d
commit c26d279b4f
3 changed files with 37 additions and 1 deletions

View File

@@ -118,7 +118,11 @@ func selectConfigScopes[C any](suite ConfigSuite[C], input configInput[C], opera
} else {
scope, ok := findConfigScope(suite.Scopes, input.Scope)
if !ok {
return nil, fmt.Errorf("unknown configuration scope %q", input.Scope)
choices := make([]string, 0, len(suite.Scopes))
for _, available := range orderedConfigScopes(suite.Scopes) {
choices = append(choices, available.Name)
}
return nil, fmt.Errorf("unknown configuration scope %q (available: %s)", input.Scope, joinStrings(choices))
}
if !containsOperation(scope.Operations, operation) {
return nil, unsupportedConfigOperation(scope, operation)