sh

package
v0.0.0-...-d7a3aff Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2025 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetermineWidth

func DetermineWidth(verbose bool) int

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 Cmd

func Cmd(input ...string) *Executor

func CmdWithCtx

func CmdWithCtx(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) RunAndStream

func (e *Executor) RunAndStream() error

RunAndStream runs the command and streams the output to os.stdOut and os.StdErr

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) SetPrintFinalCommand

func (e *Executor) SetPrintFinalCommand(printFinalCommand bool) *Executor

SetPrintFinalCommand sets the printFinalCommand flag

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
JackTT - Gopher 🇻🇳