Compile typed command runners

This commit is contained in:
2026-10-11 01:21:52 +00:00
parent 4e0611bc13
commit 74f6bdeade
5 changed files with 69 additions and 42 deletions

View File

@@ -30,16 +30,15 @@ type versionDocument struct {
}
func (a *App) installBuiltins() error {
help := NewCommand(CommandSpec[helpInput]{
help := captureCommand(CommandSpec[helpInput]{
Name: "help",
Summary: "Show help for commands.",
Description: "Describe registered commands and their inputs.",
Arguments: []Argument[helpInput]{RepeatArgument(ArgumentMeta{Name: "COMMAND", Usage: "registered command path"}, 0, -1,
func(value string) (string, error) { return value, nil },
func(input *helpInput, value Supplied[[]string]) { input.Targets = value })},
Run: func(invocation Invocation, input helpInput) Outcome {
return a.renderHelpTargets(input.Targets.Value, invocation.Streams)
},
}, func(current commandExecution, input helpInput) Outcome {
return current.renderHelpTargets(input.Targets.Value)
})
scopeDefault := "app"
formatDefault := "text"