runner

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandRunner

type CommandRunner interface {
	Run(ctx context.Context, timeout time.Duration, mode Mode,
		name string, args ...string) ([]byte, error)
}

type ExecRunner

type ExecRunner struct{}

func (ExecRunner) Run

func (ExecRunner) Run(
	parent context.Context,
	timeout time.Duration,
	mode Mode,
	name string,
	args ...string,
) ([]byte, error)

type MockCommand

type MockCommand struct {
	Name    string
	Args    []string
	Dir     string
	Env     []string
	Timeout time.Duration
	Mode    Mode
}

type MockResponse

type MockResponse struct {
	Output []byte
	Error  error
}

type MockRunner

type MockRunner struct {
	Commands     []MockCommand
	Responses    map[string]MockResponse
	ResponseFunc func(name string, args ...string) ([]byte, error)
}

func NewMockRunner

func NewMockRunner() *MockRunner

func (*MockRunner) AddResponse

func (m *MockRunner) AddResponse(key string, output []byte, err error)

func (*MockRunner) CombinedOutput

func (m *MockRunner) CombinedOutput(name string, args ...string) ([]byte, error)

func (*MockRunner) Command

func (m *MockRunner) Command(name string, args ...string) *exec.Cmd

func (*MockRunner) CommandDir

func (m *MockRunner) CommandDir(name string, dir string, args ...string) *exec.Cmd

func (*MockRunner) CommandWithEnv

func (m *MockRunner) CommandWithEnv(name string, env []string, args ...string) *exec.Cmd

func (*MockRunner) GetBrewList

func (m *MockRunner) GetBrewList(packages ...string)

func (*MockRunner) GetBrewOutdated

func (m *MockRunner) GetBrewOutdated(packages ...string)

func (*MockRunner) MockBrewInfoV2Formula added in v0.2.1

func (m *MockRunner) MockBrewInfoV2Formula(name, installed, stable string)

func (*MockRunner) Output

func (m *MockRunner) Output(name string, args ...string) ([]byte, error)

func (*MockRunner) Run

func (m *MockRunner) Run(
	ctx context.Context,
	timeout time.Duration,
	mode Mode,
	name string,
	args ...string,
) ([]byte, error)

func (*MockRunner) VerifyCommand

func (m *MockRunner) VerifyCommand(name string, args ...string) bool

func (*MockRunner) VerifyRunCount

func (m *MockRunner) VerifyRunCount(name string, count int) bool

type Mode

type Mode int
const (
	Capture Mode = iota
	Stream
)

Jump to

Keyboard shortcuts

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