Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Executor ¶
type Executor interface {
// Execute executes the given command
Execute(command string, args ...string) ([]byte, error)
// LookPath searches for an executable named file in the directories named
// by the PATH environment variable.
LookPath(file string) (string, error)
}
Executor is an interface for executing commands.
type LocalExecutor ¶
type LocalExecutor struct {
// contains filtered or unexported fields
}
LocalExecutor is an Executor that runs commands locally.
func NewLocalExecutor ¶
func NewLocalExecutor(logger *slog.Logger, options ...LocalExecutorOption) *LocalExecutor
NewLocalExecutor creates a new LocalExecutor with the given options.
type LocalExecutorOption ¶
type LocalExecutorOption func(e *LocalExecutor)
LocalExecutorOption is an option for configuring a LocalExecutor.
func WithColors ¶
func WithColors() LocalExecutorOption
WithColors configures the LocalExecutor to enable colors.
func WithRedirect ¶
func WithRedirect() LocalExecutorOption
WithRedirect configures the LocalExecutor to redirect stdout and stderr to the local process's stdout and stderr while also capturing the output.
func WithRedirectTo ¶
func WithRedirectTo(stdout, stderr io.Writer) LocalExecutorOption
WithRedirectTo configures the LocalExecutor to redirect stdout and stderr to the given writers while also capturing the output.
func WithWorkdir ¶
func WithWorkdir(workdir string) LocalExecutorOption
WithWorkdir configures the LocalExecutor to run commands in the given working directory.
type WrappedExecuter ¶
WrappedExecuter is an interface for executing commands using a specific command.
type WrappedLocalExecutor ¶
type WrappedLocalExecutor struct {
Executor
// contains filtered or unexported fields
}
WrappedLocalExecutor wraps an Executor with a specific command, allowing for easier repeated execution of the same command with different arguments.
func NewWrappedLocalExecutor ¶
func NewWrappedLocalExecutor(e Executor, command string) *WrappedLocalExecutor
NewWrappedLocalExecutor creates a new WrappedLocalExecutor that always executes the specified command using the provided Executor.