Documentation
¶
Overview ¶
Package exec provides abstractions for command execution. This package enables testable code by allowing CLI commands to be mocked.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandExecutor ¶
type CommandExecutor interface {
// Execute runs a command with the given context and arguments.
// Returns stdout, stderr, and any error that occurred.
Execute(ctx context.Context, name string, args ...string) (stdout []byte, stderr []byte, err error)
}
CommandExecutor defines an interface for executing shell commands. This abstraction allows for mocking CLI tool behavior in tests.
func DefaultExecutor ¶
func DefaultExecutor() CommandExecutor
DefaultExecutor returns the standard production executor. This is used as the default when no executor is injected.
type RealCommandExecutor ¶
type RealCommandExecutor struct{}
RealCommandExecutor executes actual shell commands using os/exec. This is the production implementation.
Click to show internal directories.
Click to hide internal directories.