Reconcile module docs and release materials
This commit is contained in:
@@ -11,7 +11,9 @@ import (
|
||||
// Selection carries the configuration and overlay choices supplied for a
|
||||
// configuration scope.
|
||||
type Selection struct {
|
||||
Config commandkit.Supplied[string]
|
||||
// Config is the caller-supplied configuration path, if present.
|
||||
Config commandkit.Supplied[string]
|
||||
// Overlay is the caller-supplied overlay path, if present.
|
||||
Overlay commandkit.Supplied[string]
|
||||
}
|
||||
|
||||
@@ -31,7 +33,9 @@ const (
|
||||
|
||||
// Request describes one configuration operation and its selected inputs.
|
||||
type Request struct {
|
||||
// Operation identifies the requested inspection operation.
|
||||
Operation Operation
|
||||
// Selection carries the explicit config and overlay inputs.
|
||||
Selection Selection
|
||||
}
|
||||
|
||||
@@ -63,33 +67,45 @@ type View struct {
|
||||
// configuration. Construction issues are retained privately until family
|
||||
// assembly attaches them to its command declaration.
|
||||
type Scope[I, S any] struct {
|
||||
Name string
|
||||
Summary string
|
||||
// Name identifies the scope in CLI selection and reports.
|
||||
Name string
|
||||
// Summary is shown when the scope is listed.
|
||||
Summary string
|
||||
// Operations selects the standard handlers exposed for this scope.
|
||||
Operations []Operation
|
||||
Acquire func(context.Context, Request, I, S) (commandkit.Acquired[View], error)
|
||||
// Acquire loads the selected configuration for one inspection invocation.
|
||||
Acquire func(context.Context, Request, I, S) (commandkit.Acquired[View], error)
|
||||
|
||||
issues []error
|
||||
}
|
||||
|
||||
// Selector binds a typed flag to the configuration scopes that use it.
|
||||
type Selector[I any] struct {
|
||||
// Binding is the original typed flag handle captured by the suite.
|
||||
Binding commandkit.Flag[I]
|
||||
Scopes []string
|
||||
// Scopes lists the scope names that receive this flag's value.
|
||||
Scopes []string
|
||||
}
|
||||
|
||||
// Suite declares the typed input, shared state, selectors, and configuration
|
||||
// scopes used to assemble configuration commands.
|
||||
type Suite[I, S any] struct {
|
||||
NewInput func() I
|
||||
NewState func() S
|
||||
Selectors []Selector[I]
|
||||
// NewInput creates fresh input storage for each selected scope.
|
||||
NewInput func() I
|
||||
// NewState creates shared acquisition state once per inspection invocation.
|
||||
NewState func() S
|
||||
// Selectors declares typed flags and their applicable scopes.
|
||||
Selectors []Selector[I]
|
||||
// CheckInput validates one initialized scope input after applicable values are applied.
|
||||
CheckInput func(scope string, selection Selection, input I) error
|
||||
Scopes []Scope[I, S]
|
||||
// Scopes declares the configuration scopes assembled by Command.
|
||||
Scopes []Scope[I, S]
|
||||
}
|
||||
|
||||
// WithScopeError returns a copy of scope that retains err as a construction
|
||||
// issue. Existing issues remain available to family assembly, and scope is not
|
||||
// mutated. A nil error returns scope unchanged.
|
||||
// issue for ckconfig.Command to report during installation. Existing issues
|
||||
// remain available to family assembly, and scope is not mutated. A nil error
|
||||
// returns scope unchanged.
|
||||
func WithScopeError[I, S any](scope Scope[I, S], err error) Scope[I, S] {
|
||||
if err == nil {
|
||||
return scope
|
||||
|
||||
Reference in New Issue
Block a user