Documentation ¶
Overview ¶
Package cmd implements a simple wrapper around "os/exec".
Index ¶
- type Builder
- func (builder Builder) Run() error
- func (builder Builder) RunWithContext(ctx context.Context) error
- func (builder Builder) WithArguments(arguments ...string) Builder
- func (builder Builder) WithEnvironment(environment map[string]string) Builder
- func (builder Builder) WithStderr(stderr io.Writer) Builder
- func (builder Builder) WithStdin(stdin io.Reader) Builder
- func (builder Builder) WithStdout(stdout io.Writer) Builder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct { Command string Arguments []string Environment []string Stdin io.Reader Stdout io.Writer Stderr io.Writer }
Builder tracks the options set for a command.
func New ¶
New creates a new command. Additional command options are added to the builder returned by New.
err := cmd.New("echo"). WithArguments("Hello, World!"). WithStdout(os.Stdout). Run()
func (Builder) RunWithContext ¶
RunWithContext runs a command with a context.
func (Builder) WithArguments ¶
WithArguments adds arguments to a command.
func (Builder) WithEnvironment ¶
WithEnvironment adds environment variables to a command.
func (Builder) WithStderr ¶
WithStderr sets an io.Writer to retrieve the error output of the command.
Click to show internal directories.
Click to hide internal directories.