exec

package
v0.0.0-...-a355528 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder collects options until it's run

func Command

func Command(s string) *Builder

Command returns a fluent builder for running a command where the command string can have template functions and arguments

func (*Builder) InheritEnvs

func (b *Builder) InheritEnvs(v bool) *Builder

InheritEnvs determines whether the process should inherit the envs of the parent

func (*Builder) Output

func (b *Builder) Output(args ...interface{}) ([]byte, error)

Output runs the command until completion and returns the results

func (*Builder) Prepare

func (b *Builder) Prepare(args ...interface{}) error

Prepare generates the command based on the input args. This is the step before actual Start or Run

func (*Builder) Start

func (b *Builder) Start(args ...interface{}) error

Start does a Cmd.Start on the command

func (*Builder) StartWithHandlers

func (b *Builder) StartWithHandlers(stdinFunc func(io.Writer) error,
	stdoutFunc func(io.Reader) error,
	stderrFunc func(io.Reader) error,
	args ...interface{}) error

StartWithHandlers starts the cmd non blocking and calls the given handlers to process input / output

func (*Builder) Stdin

func (b *Builder) Stdin(f func(w io.Writer) error) error

Stdin takes the input from the writer

func (*Builder) Stdout

func (b *Builder) Stdout(w io.Writer)

Stdout sets the stdout

func (*Builder) StdoutTo

func (b *Builder) StdoutTo(next *Builder)

StdoutTo connects the stdout of this to the next stage

func (*Builder) Wait

func (b *Builder) Wait() error

Wait waits for the command to complete

func (*Builder) WithArg

func (b *Builder) WithArg(key string, value interface{}) *Builder

WithArg sets the arg key, value pair that can be accessed via the 'arg' function

func (*Builder) WithArgs

func (b *Builder) WithArgs(args ...interface{}) *Builder

WithArgs adds the command line args array

func (*Builder) WithContext

func (b *Builder) WithContext(context interface{}) *Builder

WithContext sets the context of the template

func (*Builder) WithDir

func (b *Builder) WithDir(path string) *Builder

WithDir sets the working directory.

func (*Builder) WithEnvs

func (b *Builder) WithEnvs(kv ...string) *Builder

WithEnvs adds environment variables for the exec, in format of key=value

func (*Builder) WithFunc

func (b *Builder) WithFunc(name string, function interface{}) *Builder

WithFunc adds a function that can be used in the template

func (*Builder) WithOptions

func (b *Builder) WithOptions(options template.Options) *Builder

WithOptions adds the template options

func (*Builder) WithStderr

func (b *Builder) WithStderr(w io.Writer) *Builder

WithStderr sets the stderr writer

func (*Builder) WithStdin

func (b *Builder) WithStdin(r io.Reader) *Builder

WithStdin sets the stdin reader

func (*Builder) WithStdout

func (b *Builder) WithStdout(w io.Writer) *Builder

WithStdout sets the stdout writer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL