Documentation
¶
Index ¶
- func Redact(redactions []string, runOutput string) string
- type CaptureOutputMode
- type CmdRunner
- type MockRunner
- func (m *MockRunner) Run(runOptions *RunOptions, format string, vars ...interface{}) (RunResult, error)
- func (m *MockRunner) RunWithPositionalAndNamedArguments(runOptions *RunOptions, positionalArgs []string, namedArgs map[string]string) (RunResult, error)
- func (m *MockRunner) Stream(ctx context.Context, runOptions *RunOptions, format string, ...) (io.ReadCloser, error)
- type RunOptions
- type RunResult
- type ShellRunner
- func (sr *ShellRunner) Run(runOptions *RunOptions, format string, vars ...interface{}) (RunResult, error)
- func (sr *ShellRunner) RunWithPositionalAndNamedArguments(runOptions *RunOptions, positionalArgs []string, namedArgs map[string]string) (RunResult, error)
- func (sr *ShellRunner) SetShell(shell string)
- func (sr *ShellRunner) Stream(ctx context.Context, runOptions *RunOptions, format string, ...) (io.ReadCloser, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CaptureOutputMode ¶
type CaptureOutputMode int
const ( CaptureOutputModeCombined CaptureOutputMode = iota CaptureOutputModeStdout )
type CmdRunner ¶
type CmdRunner interface {
// Run runs a command, given runOptions
Run(runOptions *RunOptions, format string, vars ...interface{}) (RunResult, error)
// RunWithPositionalAndNamedArguments runs a command, given runOptions, positional and named arguments
RunWithPositionalAndNamedArguments(runOptions *RunOptions,
positionalArgs []string,
namedArgs map[string]string) (RunResult, error)
// Stream streams command output
Stream(ctx context.Context, runOptions *RunOptions, format string, vars ...interface{}) (io.ReadCloser, error)
}
CmdRunner specifies the interface to an underlying command runner
type MockRunner ¶
func NewMockRunner ¶
func NewMockRunner() *MockRunner
func (*MockRunner) Run ¶
func (m *MockRunner) Run(runOptions *RunOptions, format string, vars ...interface{}) (RunResult, error)
func (*MockRunner) RunWithPositionalAndNamedArguments ¶
func (m *MockRunner) RunWithPositionalAndNamedArguments(runOptions *RunOptions, positionalArgs []string, namedArgs map[string]string) (RunResult, error)
func (*MockRunner) Stream ¶
func (m *MockRunner) Stream(ctx context.Context, runOptions *RunOptions, format string, vars ...interface{}) (io.ReadCloser, error)
type RunOptions ¶
type RunOptions struct {
WorkingDir *string
Stdin *string
Env map[string]string
LogRedactions []string
CaptureOutputMode CaptureOutputMode
// will log if command executed successfully
LogOnlyOnFailure bool
// skip logging when command execution fails
SkipLogOnFailure bool
}
RunOptions specifies runOptions to CmdRunner.Run
type ShellRunner ¶
type ShellRunner struct {
// contains filtered or unexported fields
}
func NewShellRunner ¶
func NewShellRunner(parentLogger logger.Logger) (*ShellRunner, error)
func (*ShellRunner) Run ¶
func (sr *ShellRunner) Run(runOptions *RunOptions, format string, vars ...interface{}) (RunResult, error)
func (*ShellRunner) RunWithPositionalAndNamedArguments ¶
func (sr *ShellRunner) RunWithPositionalAndNamedArguments(runOptions *RunOptions, positionalArgs []string, namedArgs map[string]string) (RunResult, error)
func (*ShellRunner) SetShell ¶
func (sr *ShellRunner) SetShell(shell string)
func (*ShellRunner) Stream ¶
func (sr *ShellRunner) Stream(ctx context.Context, runOptions *RunOptions, format string, vars ...interface{}) (io.ReadCloser, error)
Click to show internal directories.
Click to hide internal directories.