command

package
v2.0.0-alpha.22 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: MIT Imports: 6 Imported by: 92

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewExitStatusError

func NewExitStatusError(printableCmdArgs string, exitErr *exec.ExitError, errorLines []string) error

NewExitStatusError ...

Types

type Command

type Command interface {
	PrintableCommandArgs() string
	Run() error
	RunAndReturnExitCode() (int, error)
	RunAndReturnTrimmedOutput() (string, error)
	RunAndReturnTrimmedCombinedOutput() (string, error)
	Start() error
	Wait() error
}

Command ...

type ErrorFinder

type ErrorFinder func(out string) []string

ErrorFinder ...

type ExitStatusError

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

ExitStatusError ...

func (*ExitStatusError) Error

func (e *ExitStatusError) Error() string

Error returns the formatted error message. Does not include the original error message (`exit status 1`).

func (*ExitStatusError) Reason

func (e *ExitStatusError) Reason() error

Reason returns the user-friendly error, to be used by errorutil.ErrorFormatter.

func (*ExitStatusError) Unwrap

func (e *ExitStatusError) Unwrap() error

Unwrap is needed for errors.Is and errors.As to work correctly.

type Factory

type Factory interface {
	Create(name string, args []string, opts *Opts) Command
}

Factory ...

func NewFactory

func NewFactory(envRepository env.Repository) Factory

NewFactory ...

type Opts

type Opts struct {
	Stdout      io.Writer
	Stderr      io.Writer
	Stdin       io.Reader
	Env         []string
	Dir         string
	ErrorFinder ErrorFinder
}

Opts ...

Jump to

Keyboard shortcuts

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