-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextension_command.go
More file actions
28 lines (26 loc) · 1012 Bytes
/
extension_command.go
File metadata and controls
28 lines (26 loc) · 1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package forge
// CLICommandProvider is an optional interface for extensions that want to
// contribute CLI commands when the app is wrapped in a CLI runner.
//
// The CLICommands method returns a slice of any values that must each
// implement cli.Command. The type is []any (rather than []cli.Command)
// to avoid a circular import — the forge package cannot import forge/cli
// since cli already imports forge.
//
// The CLI wrapper (cli.RunApp) performs type assertions at registration time
// and logs warnings for values that don't implement cli.Command.
//
// Example:
//
// func (e *MyExtension) CLICommands() []any {
// return []any{
// cli.NewCommand("seed", "Seed the database", e.handleSeed),
// cli.NewCommand("dump", "Dump database schema", e.handleDump),
// }
// }
type CLICommandProvider interface {
Extension
// CLICommands returns CLI commands contributed by this extension.
// Each element in the returned slice must implement cli.Command.
CLICommands() []any
}