Capture immutable command declarations
This commit is contained in:
10
builtins.go
10
builtins.go
@@ -30,7 +30,7 @@ type versionDocument struct {
|
||||
}
|
||||
|
||||
func (a *App) installBuiltins() error {
|
||||
help, err := NewCommand(CommandSpec[helpInput]{
|
||||
help := NewCommand(CommandSpec[helpInput]{
|
||||
Name: "help",
|
||||
Summary: "Show help for commands.",
|
||||
Description: "Describe registered commands and their inputs.",
|
||||
@@ -41,12 +41,9 @@ func (a *App) installBuiltins() error {
|
||||
return a.renderHelpTargets(input.Targets.Value, invocation.Streams)
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("create built-in help command: %w", err)
|
||||
}
|
||||
scopeDefault := "app"
|
||||
formatDefault := "text"
|
||||
version, err := NewCommand(CommandSpec[versionInput]{
|
||||
version := NewCommand(CommandSpec[versionInput]{
|
||||
Name: "version",
|
||||
Summary: "Show application or CommandKit version.",
|
||||
Description: "Report identity and build metadata without loading application configuration.",
|
||||
@@ -65,9 +62,6 @@ func (a *App) installBuiltins() error {
|
||||
return renderVersionOutcome(identity, input.Format, invocation.Streams)
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("create built-in version command: %w", err)
|
||||
}
|
||||
a.commands["help"] = &commandNode{command: help, reserved: true}
|
||||
a.commands["version"] = &commandNode{command: version, reserved: true}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user