cmd

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const CommandersGroupName = "us/cmd/commanders"
View Source
const PostRunnersGroupName = "us/cmd/post_runners"
View Source
const PreRunnersGroupName = "us/cmd/pre_runners"

Variables

View Source
var ErrServiceControllerNotConfigured = errors.New("service controller is not configured")
View Source
var ErrServiceStatusNotSupported = errors.New("service status is not supported by controller")

Functions

func Module

func Module(extends ...di.Node) di.Node

Module wires root command creation and auto-registration for all Commander implementations.

func NewServiceController added in v1.13.0

func NewServiceController() (*systemServiceController, error)

func RegisterCommands

func RegisterCommands(params registerParams) error

func Run added in v1.12.0

func Run(nodes ...di.Node) di.Node

Serve is simply an alias for Use("serve", ...) This is the default command that is run when no command is provided.

func Use

func Use(name string, nodes ...di.Node) di.Node

Use conditionally includes nodes for the selected CLI command. Selection is inferred from process args (defaults to "serve" when no command is provided). Nested commands are supported via prefix matching, for example: Use("user") matches "user list", and Use("user list") matches "user list active".

func UseBasicCommands

func UseBasicCommands() di.Node

func UseServiceCommands added in v1.13.0

func UseServiceCommands() di.Node

func UseServiceController added in v1.13.0

func UseServiceController() di.Node

func UseServiceRuntime added in v1.13.0

func UseServiceRuntime() di.Node

func WithDefaultName

func WithDefaultName(name string) di.Node

WithDefaultName configures the default command used when no subcommand is provided.

Types

type Commander

type Commander interface {
	Command() *cobra.Command // command instance
}

type HealthcheckCommand added in v1.6.0

type HealthcheckCommand struct {
	// contains filtered or unexported fields
}

func NewHealthcheckCommand added in v1.6.0

func NewHealthcheckCommand(shutdowner fx.Shutdowner) *HealthcheckCommand

func (*HealthcheckCommand) Command added in v1.6.0

func (s *HealthcheckCommand) Command() *cobra.Command

func (*HealthcheckCommand) Run added in v1.6.0

func (s *HealthcheckCommand) Run(cmd *cobra.Command, args []string) error

type HelpCommand

type HelpCommand struct {
	// contains filtered or unexported fields
}

func NewHelpCommand

func NewHelpCommand(shutdowner fx.Shutdowner) *HelpCommand

func (*HelpCommand) Command

func (s *HelpCommand) Command() *cobra.Command

func (*HelpCommand) Run

func (s *HelpCommand) Run(cmd *cobra.Command, args []string) error

type PostRunner added in v1.13.0

type PostRunner interface {
	PostRun(cmd *cobra.Command, args []string, runErr error) error
}

type PreRunner added in v1.13.0

type PreRunner interface {
	PreRun(cmd *cobra.Command, args []string) (bool, error)
}

func NewServiceRuntimeHook added in v1.13.0

func NewServiceRuntimeHook(shutdowner fx.Shutdowner, log *zap.Logger) PreRunner

type Root

type Root struct {
	*cobra.Command
}

func New

func New(cmd *cobra.Command) *Root

func (*Root) Register

func (r *Root) Register(commands ...Commander) error

func (*Root) RegisterOne

func (r *Root) RegisterOne(c Commander) error

func (*Root) Start

func (r *Root) Start(ctx context.Context) error

type ServiceCommand added in v1.13.0

type ServiceCommand struct {
	// contains filtered or unexported fields
}

func NewServiceCommand added in v1.13.0

func NewServiceCommand(in serviceCommandParams) *ServiceCommand

func (*ServiceCommand) Command added in v1.13.0

func (s *ServiceCommand) Command() *cobra.Command

type ServiceController added in v1.13.0

type ServiceController interface {
	Install(ctx context.Context) error
	Uninstall(ctx context.Context) error
	Start(ctx context.Context) error
	Stop(ctx context.Context) error
	Restart(ctx context.Context) error
}

type ServiceStatusController added in v1.13.0

type ServiceStatusController interface {
	Status(ctx context.Context, out io.Writer, follow bool) error
}

type VersionCommand

type VersionCommand struct {
	// contains filtered or unexported fields
}

func NewVersionCommand

func NewVersionCommand(shutdowner fx.Shutdowner) *VersionCommand

func (*VersionCommand) Command

func (s *VersionCommand) Command() *cobra.Command

func (*VersionCommand) Run

func (s *VersionCommand) Run(cmd *cobra.Command, args []string) error

Jump to

Keyboard shortcuts

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