Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Bindings = wire.NewSet( NewRoot, NewCommands, cmds.NewSchedule, cmds.NewMigrate, cmds.NewMigrateUp, cmds.NewMigrateUpFresh, cmds.NewMigrateDown, cmds.NewMigrateStatus, cmds.NewMigrateCreate, cmds.NewMigrateRedo, cmds.NewTest, cmds.NewTestSubTree, cmds.NewOutbox, cmds.NewOutboxReplay, cmds.NewJobs, cmds.NewJobsList, cmds.NewJobsShow, cmds.NewDev, )
Functions ¶
func NewCommands ¶ added in v0.4.0
func NewCommands( scheduleCMD *cmds.Schedule, migrateCMD *cmds.Migrate, migrateUp *cmds.MigrateUp, migrateUpFresh *cmds.MigrateUpFresh, migrateDown *cmds.MigrateDown, migrateStatus *cmds.MigrateStatus, migrateCreate *cmds.MigrateCreate, migrateRedo *cmds.MigrateRedo, testCMD *cmds.Test, testSubTree *cmds.TestSubTree, outboxCMD *cmds.Outbox, outboxReplay *cmds.OutboxReplay, jobsCMD *cmds.Jobs, jobsList *cmds.JobsList, jobsShow *cmds.JobsShow, devCMD *cmds.Dev, ) []*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.