command

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 11 Imported by: 192

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDir

func CopyDir(src, dst string, isOnlyContent bool) error

CopyDir ...

func CopyFile

func CopyFile(src, dst string) error

CopyFile ...

func DownloadAndUnZIP

func DownloadAndUnZIP(url, pth string) error

DownloadAndUnZIP ...

func PrintableCommandArgs

func PrintableCommandArgs(isQuoteFirst bool, fullCommandArgs []string) string

PrintableCommandArgs ...

func RemoveAll

func RemoveAll(pths ...string) error

RemoveAll removes recursively every file on the given paths.

func RemoveDir

func RemoveDir(dirPth string) error

RemoveDir ... Deprecated: use RemoveAll instead.

func RemoveFile

func RemoveFile(pth string) error

RemoveFile ... Deprecated: use RemoveAll instead.

func RunBashCommand

func RunBashCommand(cmdStr string) error

RunBashCommand ...

func RunBashCommandLines

func RunBashCommandLines(cmdLines []string) error

RunBashCommandLines ...

func RunCmdAndReturnExitCode

func RunCmdAndReturnExitCode(cmd *exec.Cmd) (exitCode int, err error)

RunCmdAndReturnExitCode ...

func RunCmdAndReturnTrimmedCombinedOutput

func RunCmdAndReturnTrimmedCombinedOutput(cmd *exec.Cmd) (string, error)

RunCmdAndReturnTrimmedCombinedOutput ...

func RunCmdAndReturnTrimmedOutput

func RunCmdAndReturnTrimmedOutput(cmd *exec.Cmd) (string, error)

RunCmdAndReturnTrimmedOutput ...

func RunCommand

func RunCommand(name string, args ...string) error

RunCommand ...

func RunCommandAndReturnCombinedStdoutAndStderr

func RunCommandAndReturnCombinedStdoutAndStderr(name string, args ...string) (string, error)

RunCommandAndReturnCombinedStdoutAndStderr ..

func RunCommandAndReturnStdout

func RunCommandAndReturnStdout(name string, args ...string) (string, error)

RunCommandAndReturnStdout ..

func RunCommandInDir

func RunCommandInDir(dir, name string, args ...string) error

RunCommandInDir ...

func RunCommandInDirAndReturnCombinedStdoutAndStderr

func RunCommandInDirAndReturnCombinedStdoutAndStderr(dir, name string, args ...string) (string, error)

RunCommandInDirAndReturnCombinedStdoutAndStderr ...

func RunCommandInDirAndReturnExitCode

func RunCommandInDirAndReturnExitCode(dir, name string, args ...string) (int, error)

RunCommandInDirAndReturnExitCode ...

func RunCommandInDirWithEnvsAndReturnExitCode

func RunCommandInDirWithEnvsAndReturnExitCode(envs []string, dir, name string, args ...string) (int, error)

RunCommandInDirWithEnvsAndReturnExitCode ...

func RunCommandWithEnvsAndReturnExitCode

func RunCommandWithEnvsAndReturnExitCode(envs []string, name string, args ...string) (int, error)

RunCommandWithEnvsAndReturnExitCode ...

func RunCommandWithReaderAndWriters

func RunCommandWithReaderAndWriters(inReader io.Reader, outWriter, errWriter io.Writer, name string, args ...string) error

RunCommandWithReaderAndWriters ...

func RunCommandWithWriters

func RunCommandWithWriters(outWriter, errWriter io.Writer, name string, args ...string) error

RunCommandWithWriters ...

func UnZIP

func UnZIP(src, dest string) error

UnZIP ...

Types

type Model

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

Model ...

func New

func New(name string, args ...string) *Model

New ...

func NewFromSlice

func NewFromSlice(slice []string) (*Model, error)

NewFromSlice ...

func NewWithCmd

func NewWithCmd(cmd *exec.Cmd) *Model

NewWithCmd ...

func NewWithParams

func NewWithParams(params ...string) (*Model, error)

NewWithParams ...

func NewWithStandardOuts

func NewWithStandardOuts(name string, args ...string) *Model

NewWithStandardOuts - same as NewCommand, but sets the command's stdout and stderr to the standard (OS) out (os.Stdout) and err (os.Stderr)

func (*Model) AppendEnvs

func (m *Model) AppendEnvs(envs ...string) *Model

AppendEnvs - appends the envs to the current os.Environ() Calling this multiple times will NOT appens the envs one by one, only the last "envs" set will be appended to os.Environ()!

func (*Model) GetCmd

func (m *Model) GetCmd() *exec.Cmd

GetCmd ...

func (Model) PrintableCommandArgs

func (m Model) PrintableCommandArgs() string

PrintableCommandArgs ...

func (Model) Run

func (m Model) Run() error

Run ...

func (Model) RunAndReturnExitCode

func (m Model) RunAndReturnExitCode() (int, error)

RunAndReturnExitCode ...

func (Model) RunAndReturnTrimmedCombinedOutput

func (m Model) RunAndReturnTrimmedCombinedOutput() (string, error)

RunAndReturnTrimmedCombinedOutput ...

func (Model) RunAndReturnTrimmedOutput

func (m Model) RunAndReturnTrimmedOutput() (string, error)

RunAndReturnTrimmedOutput ...

func (*Model) SetDir

func (m *Model) SetDir(dir string) *Model

SetDir ...

func (*Model) SetEnvs

func (m *Model) SetEnvs(envs ...string) *Model

SetEnvs ...

func (*Model) SetStderr

func (m *Model) SetStderr(err io.Writer) *Model

SetStderr ...

func (*Model) SetStdin

func (m *Model) SetStdin(in io.Reader) *Model

SetStdin ...

func (*Model) SetStdout

func (m *Model) SetStdout(out io.Writer) *Model

SetStdout ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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