Documentation
¶
Overview ¶
Package cmd provides support for running commands.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandRunner ¶
type CommandRunner interface {
RunCommand(ctx context.Context, stdoutBuf, stderrBuf io.Writer, dir, name string, args ...string) error
}
CommandRunner is the common interface for this module.
type FakeCommandRunner ¶
type FakeCommandRunner struct { // Stdout and Stderr will be written to the buffers passed into RunCommand. Stdout string Stderr string // Only one of ExpectedCmd and ExpectedCmdPartial can be set. // If ExpectedCmd is set, then that should be exactly the command's name and args, or RunCommand will return an error. ExpectedCmd []string // If ExpectedCmdPartial is set, then that should be a segment of the command's name and args, in order, or RunCommand will return an error. ExpectedCmdPartial []string // If ExpectedDir is set, then it should be exactly the dir passed into RunCommand. ExpectedDir string // If FailCommand is True, then RunCommand will raise FailError. FailCommand bool FailError error }
FakeCommandRunner does not actually run commands. It is used for testing.
func (FakeCommandRunner) RunCommand ¶
func (c FakeCommandRunner) RunCommand(ctx context.Context, stdoutBuf, stderrBuf io.Writer, dir, name string, args ...string) error
RunCommand runs a command (not actually).
type FakeCommandRunnerMulti ¶
type FakeCommandRunnerMulti struct { CommandRunners []FakeCommandRunner // contains filtered or unexported fields }
FakeCommandRunnerMulti provides multiple command runners. Each command is expected to be run in the given order.
func (*FakeCommandRunnerMulti) RunCommand ¶
func (c *FakeCommandRunnerMulti) RunCommand(ctx context.Context, stdoutBuf, stderrBuf io.Writer, dir, name string, args ...string) error
RunCommand runs a command (not actually).
type RealCommandRunner ¶
type RealCommandRunner struct{}
RealCommandRunner actually runs commands.
func (RealCommandRunner) RunCommand ¶
func (c RealCommandRunner) RunCommand(ctx context.Context, stdoutBuf, stderrBuf io.Writer, dir, name string, args ...string) error
RunCommand runs a command.
Click to show internal directories.
Click to hide internal directories.