cmd

package
v0.22.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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:

  1. Create constructor in cmd/cmds/ (e.g. NewVersion(...deps) *Version)
  2. 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

type Root added in v0.4.0

type Root struct {
	*cobra.Command
}

func NewRoot added in v0.4.0

func NewRoot() *Root

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL