cmdr

package
v0.0.0-...-2392c82 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnvMapToEnv

func EnvMapToEnv(env map[string]string) []string

EnvMapToEnv converts a map of environment variables to a slice of strings

Types

type Executor

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

func New

func New(input ...string) *Executor

func NewWithContext

func NewWithContext(ctx context.Context, cmd ...string) *Executor

func (*Executor) Dir

func (e *Executor) Dir(dir string) *Executor

Dir sets the working directory for the command

func (*Executor) Run

func (e *Executor) Run() error

Run runs the command

func (*Executor) RunWithWriters

func (e *Executor) RunWithWriters(stdOut, errOut io.Writer) error

RunWithWriters executes the command and writes the output to the provided writers If stdOut or stdErr are nil, they are not used.

func (*Executor) SetArgs

func (e *Executor) SetArgs(args ...string) *Executor

SetArgs sets the arguments for the command

func (*Executor) SetEnv

func (e *Executor) SetEnv(env []string) *Executor

SetEnv sets the environment variables for the command

func (*Executor) StdOut

func (e *Executor) StdOut() (string, error)

StdOut runs the command, and returns the stdout as a string

func (*Executor) Stdin

func (e *Executor) Stdin(in io.Reader) *Executor

Stdin sets the stdin for the command

func (*Executor) String

func (e *Executor) String() (string, error)

String runs the command, and returns the combined stdout and stderr as a string

Jump to

Keyboard shortcuts

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