shell

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

type Executor interface {
	// Execute runs a command and returns its standard output
	Execute(name string, args ...string) ([]byte, error)

	// ExecuteWithStdio runs a command with connected standard I/O
	ExecuteWithStdio(name string, args ...string) error

	// LookPath checks if a command exists
	LookPath(name string) (string, error)
}

Executor abstracts shell command execution

type MockExecutor

type MockExecutor struct {
	ExecuteFunc          func(name string, args ...string) ([]byte, error)
	ExecuteWithStdioFunc func(name string, args ...string) error
	LookPathFunc         func(name string) (string, error)
}

MockExecutor for testing

func (*MockExecutor) Execute

func (m *MockExecutor) Execute(name string, args ...string) ([]byte, error)

func (*MockExecutor) ExecuteWithStdio

func (m *MockExecutor) ExecuteWithStdio(name string, args ...string) error

func (*MockExecutor) LookPath

func (m *MockExecutor) LookPath(name string) (string, error)

type RealExecutor

type RealExecutor struct{}

RealExecutor implements actual command execution

func NewRealExecutor

func NewRealExecutor() *RealExecutor

NewRealExecutor creates a new RealExecutor

func (*RealExecutor) Execute

func (e *RealExecutor) Execute(name string, args ...string) ([]byte, error)

Execute runs a command and returns its output

func (*RealExecutor) ExecuteWithStdio

func (e *RealExecutor) ExecuteWithStdio(name string, args ...string) error

ExecuteWithStdio runs a command with connected standard I/O

func (*RealExecutor) LookPath

func (e *RealExecutor) LookPath(name string) (string, error)

LookPath checks if a command exists in PATH

Jump to

Keyboard shortcuts

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