Documentation ¶
Index ¶
- func CLI(c *Command) string
- func DefaultCommandRunner(c *Command) (string, error)
- func DryRunCommandRunner(c *Command) (string, error)
- func QuietCommandRunner(c *Command) (string, error)
- type Command
- func (c *Command) Attempts() int
- func (c *Command) CLI() string
- func (c *Command) CurrentArgs() []string
- func (c *Command) CurrentDir() string
- func (c *Command) CurrentEnv() map[string]string
- func (c *Command) CurrentName() string
- func (c *Command) DidError() bool
- func (c *Command) DidFail() bool
- func (c *Command) Error() error
- func (c *Command) Run() (string, error)
- func (c *Command) RunWithoutRetry() (string, error)
- func (c *Command) SetArgs(args []string)
- func (c *Command) SetDir(dir string)
- func (c *Command) SetEnv(env map[string]string)
- func (c *Command) SetEnvVariable(name string, value string)
- func (c *Command) SetExponentialBackOff(backoff *backoff.ExponentialBackOff)
- func (c *Command) SetName(name string)
- func (c *Command) SetTimeout(timeout time.Duration)
- func (c *Command) String() string
- type CommandError
- type CommandRunner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultCommandRunner ¶
DefaultCommandRunner default runner if none is set
func DryRunCommandRunner ¶
DryRunCommandRunner output the commands to be run
func QuietCommandRunner ¶
QuietCommandRunner uses debug level logging to output commands executed and results
Types ¶
type Command ¶
type Command struct { Errors []error Dir string Name string Args []string ExponentialBackOff *backoff.ExponentialBackOff Timeout time.Duration Out io.Writer Err io.Writer In io.Reader Env map[string]string // contains filtered or unexported fields }
Command is a struct containing the details of an external command to be executed
func NewCommand ¶
NewCommand helper to create a new command
func (*Command) CurrentArgs ¶
CurrentArgs returns the current command arguments
func (*Command) CurrentDir ¶
CurrentDir returns the current Dir
func (*Command) CurrentEnv ¶
CurrentEnv returns the current environment variables
func (*Command) CurrentName ¶
CurrentName returns the current name of the command
func (*Command) DidError ¶
DidError returns a boolean if any error occurred in any execution of the command
func (*Command) DidFail ¶
DidFail returns a boolean if the command could not complete (errored on every attempt)
func (*Command) RunWithoutRetry ¶
RunWithoutRetry Execute the command without retrying on failure and block waiting for return values
func (*Command) SetArgs ¶
SetArgs Setter method for Args to enable use of interface instead of Command struct
func (*Command) SetDir ¶
SetDir Setter method for Dir to enable use of interface instead of Command struct
func (*Command) SetEnv ¶
SetEnv Setter method for Env to enable use of interface instead of Command struct
func (*Command) SetEnvVariable ¶
SetEnvVariable sets an environment variable into the environment
func (*Command) SetExponentialBackOff ¶
func (c *Command) SetExponentialBackOff(backoff *backoff.ExponentialBackOff)
SetExponentialBackOff Setter method for ExponentialBackOff to enable use of interface instead of Command struct
func (*Command) SetName ¶
SetName Setter method for Name to enable use of interface instead of Command struct
func (*Command) SetTimeout ¶
SetTimeout Setter method for Timeout to enable use of interface instead of Command struct
type CommandError ¶
type CommandError struct { Command Command Output string // contains filtered or unexported fields }
CommandError is the error object encapsulating an error from a Command
func (CommandError) Cause ¶
func (c CommandError) Cause() error
func (CommandError) Error ¶
func (c CommandError) Error() string
type CommandRunner ¶
CommandRunner represents a command runner so that it can be stubbed out for testing