command

package
v7.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2019 License: MIT Imports: 6 Imported by: 17

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDebug

func SetDebug(value bool)

SetDebug sets whether or not we are in debug mode

Types

type Result

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

Result contains the results of a command run in a subshell.

func Run

func Run(cmd string, args ...string) *Result

Run executes the command given in argv notation.

func RunDirEnv

func RunDirEnv(dir string, env []string, cmd string, args ...string) *Result

RunDirEnv executes the given command in the given directory, using the given environment variables.

func RunInDir

func RunInDir(dir string, cmd string, args ...string) *Result

RunInDir executes the given command in the given directory.

func (*Result) Args

func (c *Result) Args() []string

Args provids the arguments used when running the command.

func (*Result) Command

func (c *Result) Command() string

Command provides the command run that led to this result.

func (*Result) Err

func (c *Result) Err() error

Err returns the error that this command encountered. Runs the command if it hasn't so far.

func (*Result) Output

func (c *Result) Output() string

Output returns the output of this command. Runs if it hasn't so far.

func (*Result) OutputContainsLine

func (c *Result) OutputContainsLine(line string) bool

OutputContainsLine returns whether the output of this command contains the given line

func (*Result) OutputContainsText

func (c *Result) OutputContainsText(text string) bool

OutputContainsText returns whether the output of this command contains the given text

func (*Result) OutputLines

func (c *Result) OutputLines() []string

OutputLines returns the output of this command, split into lines. Runs if it hasn't so far.

func (*Result) OutputSanitized

func (c *Result) OutputSanitized() string

OutputSanitized provides the output without ANSI color codes.

Jump to

Keyboard shortcuts

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