Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Bindings = wire.NewSet( NewRoot, NewCommands, cmds.NewSchedule, cmds.NewTest, cmds.NewTestSubTree, )
Functions ¶
func NewCommands ¶ added in v0.4.0
func NewCommands( scheduleCMD *cmds.Schedule, testCMD *cmds.Test, testSubTree *cmds.TestSubTree, ) []*cobra.Command
NewCommands is the central CLI command registry.
Wire instantiates all command providers listed as parameters, then this function assembles them into []*cobra.Command for Root.
Subcommand tree is built here — attach children to parents via AddCommand. Only root-level commands are returned; Root receives and registers them.
Example with namespace:
func NewCommands(
schedule *cmds.Schedule,
configCmd *cmds.ConfigCmd,
configSet *cmds.ConfigSet,
) []*cobra.Command {
configCmd.AddCommand(configSet.Command) // build tree here
return []*cobra.Command{ // return only root commands
schedule.Command,
configCmd.Command,
}
}
Adding a new command:
- Create constructor in cmd/cmds/ (e.g. NewVersion(...deps) *Version)
- Add provider to Bindings and parameter + line here
Wire guarantees compile-time safety in both directions:
- Provider in Bindings but missing here → "unused provider"
- Parameter here but missing in Bindings → "no provider for"
Types ¶
Click to show internal directories.
Click to hide internal directories.