command

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action[T any] interface {
	Run(opts ...Option[T]) error
}

type App

type App interface {
	ExecName() string
	Args() []string

	UserConfig() *types.Config
	ProfileConfig(profile string) *types.Config

	Command(name string) bool
	RunSubCommand() error

	Usage(format string)
	Exit(code int)
	Printf(format string, a ...interface{}) (n int, err error)
}

type ConsoleMock

type ConsoleMock[T any] struct {
	mock.Mock
}

func (*ConsoleMock[T]) Args

func (m *ConsoleMock[T]) Args() []string

func (*ConsoleMock[T]) Command

func (m *ConsoleMock[T]) Command(name string) bool

func (*ConsoleMock[T]) ExecName

func (m *ConsoleMock[T]) ExecName() string

func (*ConsoleMock[T]) Exit

func (m *ConsoleMock[T]) Exit(code int)

func (*ConsoleMock[T]) Handle

func (m *ConsoleMock[T]) Handle(a App) (Action[T], []Option[T], error)

func (*ConsoleMock[T]) Printf

func (m *ConsoleMock[T]) Printf(format string, a ...any) (int, error)

func (*ConsoleMock[T]) ProfileConfig

func (m *ConsoleMock[T]) ProfileConfig(a string) *types.Config

func (*ConsoleMock[T]) Run

func (m *ConsoleMock[T]) Run(opts ...Option[T]) error

func (*ConsoleMock[T]) RunSubCommand

func (m *ConsoleMock[T]) RunSubCommand() error

func (*ConsoleMock[T]) Usage

func (m *ConsoleMock[T]) Usage(format string)

func (*ConsoleMock[T]) UserConfig

func (m *ConsoleMock[T]) UserConfig() *types.Config

type Handler

type Handler[T any] interface {
	Handle(App) (Action[T], []Option[T], error)
}

type HandlerMock

type HandlerMock[T any] struct {
	mock.Mock
	// contains filtered or unexported fields
}

func NewHandlerMock

func NewHandlerMock[T any](f func(a App) (Action[T], []Option[T], error)) *HandlerMock[T]

func (*HandlerMock[T]) Handle

func (m *HandlerMock[T]) Handle(a App) (Action[T], []Option[T], error)

func (*HandlerMock[T]) Run

func (m *HandlerMock[T]) Run(opts ...Option[T]) error

type Option

type Option[T any] func(*T)

Jump to

Keyboard shortcuts

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