Require configuration selectors only for applicable scopes

This commit is contained in:
2026-10-07 16:44:10 +00:00
parent 9f47c7d9bc
commit d8db15f74d
4 changed files with 61 additions and 7 deletions

View File

@@ -74,6 +74,7 @@ type ConfigScope[C any] struct {
}
// Selector binds one typed command flag to selected configuration scopes.
// A required binding is required only when a selected scope uses it.
type Selector[C any] struct {
Binding Flag[C]
Scopes []string
@@ -101,6 +102,8 @@ type configScopesInput struct {
}
type selectorState[C any] struct {
name string
required bool
scopes []string
supplied bool
apply func(*C)