Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandExecutor ¶
type CommandExecutor interface {
// LookPath searches for an executable named file in the directories
// named by the PATH environment variable.
LookPath(file string) (string, error)
// Execute runs the command with the given name and arguments.
// It waits for the command to complete and returns any error.
Execute(name string, arg ...string) error
}
CommandExecutor defines an interface for running external commands. This abstraction allows for easier testing by providing a mockable interface.
type MockCommandExecutor ¶
type MockCommandExecutor struct {
// Commands records all commands that were executed
Commands []string
// LookPathFunc allows custom behavior for LookPath in tests
LookPathFunc func(file string) (string, error)
// ExecuteFunc allows custom behavior for Execute in tests
ExecuteFunc func(name string, arg ...string) error
}
MockCommandExecutor is a mock implementation of CommandExecutor for testing. It records all commands that would be executed without actually running them.
type RealCommandExecutor ¶
type RealCommandExecutor struct{}
RealCommandExecutor implements CommandExecutor using the actual os/exec package. This is the production implementation that executes real system commands.
Click to show internal directories.
Click to hide internal directories.