Add configuration path explanations

This commit is contained in:
2026-10-07 14:17:46 +00:00
parent 25b412ea93
commit c0be9ffadc
8 changed files with 437 additions and 9 deletions

View File

@@ -111,6 +111,7 @@ type configInput[C any] struct {
Selection Selection
Scope string
Format string
Path Supplied[string]
SelectorContext C
selectors []selectorState[C]
}
@@ -131,8 +132,8 @@ func RegisterConfig[C any](app *App, suite ConfigSuite[C]) error {
return fmt.Errorf("command path %q is already registered", "config")
}
commands := make([]Command, 0, 4)
installed := make([]ConfigOperation, 0, 3)
commands := make([]Command, 0, 5)
installed := make([]ConfigOperation, 0, 4)
if configOperationDeclared(normalized.Scopes, ConfigValidate) {
validate, err := newConfigValidateCommand(normalized)
if err != nil {
@@ -157,6 +158,14 @@ func RegisterConfig[C any](app *App, suite ConfigSuite[C]) error {
commands = append(commands, sources)
installed = append(installed, ConfigSources)
}
if configOperationDeclared(normalized.Scopes, ConfigExplain) {
explain, err := newConfigExplainCommand(normalized)
if err != nil {
return err
}
commands = append(commands, explain)
installed = append(installed, ConfigExplain)
}
command, err := newConfigScopesCommandWithScopes(normalized.Scopes, installed)
if err != nil {
return err