Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandContext ¶
type CommandContext interface { // Env returns the environment variables set for the CommandContext Env() []string // Dir returns the directory set for the CommandContext Dir() string // Stdin returns the stdin set for the CommandContext Stdin() io.Reader // Run runs a given command and will append any extra paths to the configured directory Run(cmd *exec.Cmd, path ...string) ([]byte, error) }
CommandContext represents the context that commands are run in
type GenericCommandContext ¶
type GenericCommandContext struct {
// contains filtered or unexported fields
}
GenericCommandContext is a generic implementation of the CommandContext interface
func NewGenericCommandContext ¶
func NewGenericCommandContext(opts ...GenericCommandContextOptions) *GenericCommandContext
NewGenericCommandContext creates a new GenericCommandContext that can be configured via GenericCommandContextOptions functions
func (*GenericCommandContext) Dir ¶
func (gcc *GenericCommandContext) Dir() string
Dir returns the directory set for the GenericCommandContext
func (*GenericCommandContext) Env ¶
func (gcc *GenericCommandContext) Env() []string
Env returns the environment variables set for the GenericCommandContext
func (*GenericCommandContext) Run ¶
Run runs a given command and will append any extra paths to the configured directory
func (*GenericCommandContext) Stdin ¶
func (gcc *GenericCommandContext) Stdin() io.Reader
Stdin returns the stdin set for the GenericCommandContext
type GenericCommandContextOptions ¶
type GenericCommandContextOptions func(gcc *GenericCommandContext)
GenericCommandContextOptions is a function used to configure a GenericCommandContext
func WithDir ¶
func WithDir(dir string) GenericCommandContextOptions
WithDir sets the directory that commands should be run in
func WithEnv ¶
func WithEnv(env ...string) GenericCommandContextOptions
WithEnv sets the environment variables that should be used when running commands
func WithStdin ¶
func WithStdin(stdin io.Reader) GenericCommandContextOptions
WithStdin sets the stdin when running commands