cmd

package
v0.0.0-...-d389d3b Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command interface {
	// Use is the one-line usage message.
	// Recommended syntax is as follow:
	//   [ ] identifies an optional argument. Arguments that are not enclosed in brackets are required.
	//   ... indicates that you can specify multiple values for the previous argument.
	//   |   indicates mutually exclusive information. You can use the argument to the left of the separator or the
	//       argument to the right of the separator. You cannot use both arguments in a single use of the command.
	//   { } delimits a set of mutually exclusive arguments when one of the arguments is required. If the arguments are
	//       optional, they are enclosed in brackets ([ ]).
	// Example: add [-F file | -D dir]... [-f format] profile
	Use() string

	// Short returns string about short description of the command
	// the string is shown in help screen of cobra command
	Short() string

	// Setup is used to setup flags or pre-run steps for the command.
	//
	// For example,
	//  cmd.Flags().IntVarP(&r.num, "num", "n", 5, "description")
	//
	Setup(cmd *cobra.Command)

	// Run runs the command runner
	// run returns command runner which is a function with dependency
	// injected arguments.
	//
	// For example,
	//  Command{
	//   Run: func(l lib.Logger) {
	// 	   l.Info("i am working")
	// 	 },
	//  }
	//
	Run(cmd *cobra.Command) CommandRunner // TODO, RunE instead?
}

Command interface is used to implement sub-commands in the system.

func NewHTTPServerCommand

func NewHTTPServerCommand() Command

func NewMigrationCommand

func NewMigrationCommand() Command

type CommandRunner

type CommandRunner interface{}

type HTTPServerCommand

type HTTPServerCommand struct{}

func (*HTTPServerCommand) Run

func (*HTTPServerCommand) Setup

func (s *HTTPServerCommand) Setup(cmd *cobra.Command)

func (*HTTPServerCommand) Short

func (s *HTTPServerCommand) Short() string

func (*HTTPServerCommand) Use

func (s *HTTPServerCommand) Use() string

type MigrationCommand

type MigrationCommand struct{}

func (MigrationCommand) Run

func (MigrationCommand) Setup

func (m MigrationCommand) Setup(cmd *cobra.Command)

func (MigrationCommand) Short

func (m MigrationCommand) Short() string

func (MigrationCommand) Use

func (m MigrationCommand) Use() string

type RabbitMQCommand

type RabbitMQCommand struct{}

func NewRabbitMQCommand

func NewRabbitMQCommand() *RabbitMQCommand

func (*RabbitMQCommand) Run

func (*RabbitMQCommand) Setup

func (s *RabbitMQCommand) Setup(cmd *cobra.Command)

func (*RabbitMQCommand) Short

func (s *RabbitMQCommand) Short() string

func (*RabbitMQCommand) Use

func (s *RabbitMQCommand) Use() string

type RootCommand

type RootCommand struct {
	*cobra.Command
}

func NewRootCommand

func NewRootCommand(assets *config.AssetsConfig) *RootCommand

func (RootCommand) Add

func (r RootCommand) Add(command Command, boot func(runner CommandRunner))

Jump to

Keyboard shortcuts

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