errcmd

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2021 License: MIT Imports: 18 Imported by: 11

Documentation

Index

Constants

View Source
const (
	InvalidExitCode             = consts.InvalidExitCode
	SuccessfullyRunningExitCode = consts.CmdSuccessfullyRunningExitCode
	ScriptsMultiLineJoiner      = " && \\ \n" // " && \\ \n"
	SingleLineScriptsJoiner     = " && "      // " && "

)

Variables

This section is empty.

Functions

func ArgsJoin added in v0.5.1

func ArgsJoin(args ...string) string

func ArgsJoinAppend added in v0.7.1

func ArgsJoinAppend(argAppend string, args ...string) string

func ArgsJoinPrepend added in v0.7.1

func ArgsJoinPrepend(argPrepend string, args ...string) string

func ArgsJoinSlice added in v0.5.1

func ArgsJoinSlice(args []string) string

func ArgsJoinSlicePtr added in v0.5.1

func ArgsJoinSlicePtr(args *[]string) string

func ArgsJoinWithSingle added in v0.6.5

func ArgsJoinWithSingle(arg1 string, args ...string) string

func BashArgsErrorWrapper added in v0.5.1

func BashArgsErrorWrapper(
	args ...string,
) *errorwrapper.Wrapper

func BashOutput added in v0.5.0

func BashOutput(
	scriptLines ...string,
) string

func BashScriptsErrorWrapper added in v0.5.2

func BashScriptsErrorWrapper(
	scriptLines ...string,
) *errorwrapper.Wrapper

func ChainCmdSuccess added in v0.5.0

func ChainCmdSuccess(
	scriptType scripttype.Variant,
	scriptLines ...string,
) (errorWrapper *errorwrapper.Wrapper, isAllSuccess bool)

ChainCmdSuccess if any script is failed to run then don't continue others

Returns true if scriptLines length 0

func ChangeDirScriptLine added in v0.5.2

func ChangeDirScriptLine(changeDirPath string) string

ChangeDirScriptLine cd path

func DisposeBuffer added in v0.7.9

func DisposeBuffer(buff *bytes.Buffer)

func DisposeBytesPtr added in v0.7.9

func DisposeBytesPtr(allBytes *[]byte)

func DisposeStringsPtr added in v0.7.9

func DisposeStringsPtr(allBytes *[]string)

func GetExitCode added in v0.7.3

func GetExitCode(
	errorWrapper *errorwrapper.Wrapper,
	exitError *exec.ExitError,
) int

func GetScriptOfChangeDirPlusScripts added in v0.5.2

func GetScriptOfChangeDirPlusScripts(changeDirPath string, scriptsLines ...string) string

GetScriptOfChangeDirPlusScripts cd path && \ \n scripts...

func IsBashArgsSuccess added in v0.5.1

func IsBashArgsSuccess(
	args ...string,
) bool

func IsBashScriptsSuccess added in v0.5.1

func IsBashScriptsSuccess(
	scriptLines ...string,
) bool

func IsShellArgsSuccess added in v0.5.1

func IsShellArgsSuccess(
	args ...string,
) bool

func IsShellScriptsSuccess added in v0.5.1

func IsShellScriptsSuccess(
	scriptLines ...string,
) bool

func IsSuccess added in v0.5.0

func IsSuccess(
	scriptType scripttype.Variant,
	scriptLines ...string,
) bool

func IsSuccessBashArgs added in v0.5.2

func IsSuccessBashArgs(
	args ...string,
) bool

func ShellArgsErrorWrapper added in v0.5.1

func ShellArgsErrorWrapper(
	args ...string,
) *errorwrapper.Wrapper

func ShellOutput added in v0.5.0

func ShellOutput(
	scriptLines ...string,
) string

func ShellScriptsErrorWrapper added in v0.5.1

func ShellScriptsErrorWrapper(
	scriptLines ...string,
) *errorwrapper.Wrapper

Types

type BaseBufferStdOutError

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

func (*BaseBufferStdOutError) CombinedBothErrorOutputLines added in v0.7.9

func (it *BaseBufferStdOutError) CombinedBothErrorOutputLines() []string

func (*BaseBufferStdOutError) CompiledErrorLines

func (it *BaseBufferStdOutError) CompiledErrorLines() []string

func (*BaseBufferStdOutError) CompiledOutputLines

func (it *BaseBufferStdOutError) CompiledOutputLines() []string

func (*BaseBufferStdOutError) CompiledTrimmedErrorLines

func (it *BaseBufferStdOutError) CompiledTrimmedErrorLines() []string

func (*BaseBufferStdOutError) CompiledTrimmedErrorOutput

func (it *BaseBufferStdOutError) CompiledTrimmedErrorOutput() string

func (*BaseBufferStdOutError) CompiledTrimmedOutput

func (it *BaseBufferStdOutError) CompiledTrimmedOutput() string

func (*BaseBufferStdOutError) CompiledTrimmedOutputLines

func (it *BaseBufferStdOutError) CompiledTrimmedOutputLines() []string

func (*BaseBufferStdOutError) Dispose added in v0.7.9

func (it *BaseBufferStdOutError) Dispose()

func (*BaseBufferStdOutError) ErrorBytes

func (it *BaseBufferStdOutError) ErrorBytes() []byte

func (*BaseBufferStdOutError) ErrorString

func (it *BaseBufferStdOutError) ErrorString() string

func (*BaseBufferStdOutError) HasErrorBuffer

func (it *BaseBufferStdOutError) HasErrorBuffer() bool

func (*BaseBufferStdOutError) HasOutputBuffer

func (it *BaseBufferStdOutError) HasOutputBuffer() bool

func (*BaseBufferStdOutError) OutputBytes

func (it *BaseBufferStdOutError) OutputBytes() []byte

func (*BaseBufferStdOutError) OutputString

func (it *BaseBufferStdOutError) OutputString() string

type BaseCmdWrapper

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

func (*BaseCmdWrapper) Dispose added in v0.7.9

func (it *BaseCmdWrapper) Dispose()

type CmdCompiledOutput added in v0.8.0

type CmdCompiledOutput struct {
	Cmd         *exec.Cmd
	Output      corestr.SimpleStringOnce
	Error       error
	ProcessName string
	Arguments   []string
}

func CombinedOutputError added in v0.8.0

func CombinedOutputError(
	stdIn *StdIn,
	processName string,
	args ...string,
) *CmdCompiledOutput

CombinedOutputError

stdIn can be nil

func InvalidCmdCompiledOutput added in v0.8.0

func InvalidCmdCompiledOutput(
	err error,
	process string,
	args []string,
) *CmdCompiledOutput

func (CmdCompiledOutput) Clone added in v0.8.0

func (*CmdCompiledOutput) CloneCmd added in v0.8.0

func (it *CmdCompiledOutput) CloneCmd() *exec.Cmd

func (*CmdCompiledOutput) ClonePtr added in v0.8.0

func (it *CmdCompiledOutput) ClonePtr() *CmdCompiledOutput

func (*CmdCompiledOutput) Dispose added in v0.8.0

func (it *CmdCompiledOutput) Dispose()

type CmdOnce

type CmdOnce struct {
	Cmd *exec.Cmd

	CustomMessage *CustomMessage
	// contains filtered or unexported fields
}

func BashArgs added in v0.5.1

func BashArgs(
	args ...string,
) *CmdOnce

func BashChangeDirPlusRunArgs added in v0.5.2

func BashChangeDirPlusRunArgs(
	changeDirPath string,
	args ...string,
) *CmdOnce

func BashChangeDirPlusRunScripts added in v0.5.2

func BashChangeDirPlusRunScripts(
	changeDirPath string,
	scriptLines ...string,
) *CmdOnce

func BashScripts added in v0.5.1

func BashScripts(
	scriptLines ...string,
) *CmdOnce

func BashScriptsSingleLine added in v0.5.2

func BashScriptsSingleLine(
	changeDirPath string,
	scriptLines ...string,
) *CmdOnce

func ChangeDirPlusRunScriptsCmdOnce added in v0.5.2

func ChangeDirPlusRunScriptsCmdOnce(
	scriptType scripttype.Variant,
	changeDirPath string,
	scriptLines ...string,
) *CmdOnce

func Conditional added in v0.6.5

func Conditional(
	isTrue bool,
	trueCmdOne, falseCmdOnce *CmdOnce,
) *CmdOnce

func NewCmdOnce

func NewCmdOnce(
	hasOutput,
	hasSecureData bool,
	process string,
	arguments ...string,
) *CmdOnce

func NewCmdOnceDefault

func NewCmdOnceDefault(
	process string,
	arguments ...string,
) *CmdOnce

func NewCmdOnceNoOutput

func NewCmdOnceNoOutput(
	process string,
	arguments ...string,
) *CmdOnce

func NewCmdOnceOutput

func NewCmdOnceOutput(
	process string,
	arguments ...string,
) *CmdOnce

func NewCmdOnceUsingCmd

func NewCmdOnceUsingCmd(
	hasOutput,
	hasSecureData bool,
	cmd *exec.Cmd,
) *CmdOnce

func NewCmdOnceUsingEmpty added in v0.5.0

func NewCmdOnceUsingEmpty() *CmdOnce

func NewCmdOnceUsingScriptType

func NewCmdOnceUsingScriptType(
	hasOutput,
	hasSecureData bool,
	scriptType scripttype.Variant,
	scriptLines ...string,
) *CmdOnce

func ScriptArgumentsDefault added in v0.5.1

func ScriptArgumentsDefault(
	scriptType scripttype.Variant,
	args ...string,
) *CmdOnce

func ScriptCmdOnceUsingArguments added in v0.5.1

func ScriptCmdOnceUsingArguments(
	hasOutput,
	hasSecureData bool,
	scriptType scripttype.Variant,
	args ...string,
) *CmdOnce

func ScriptsDefault added in v0.5.2

func ScriptsDefault(
	scriptType scripttype.Variant,
	scriptLines ...string,
) *CmdOnce

func ShellArgs added in v0.5.1

func ShellArgs(
	args ...string,
) *CmdOnce

func ShellScripts added in v0.5.1

func ShellScripts(
	scriptLines ...string,
) *CmdOnce

func (*CmdOnce) AddEnvVar

func (it *CmdOnce) AddEnvVar(
	varName, varValue string,
) *CmdOnce

AddEnvVar cannot add slice if already executed. Warning : panic if called after execution.

func (*CmdOnce) AddEnvVarKeyVal

func (it *CmdOnce) AddEnvVarKeyVal(keyVal corestr.KeyValuePair) *CmdOnce

AddEnvVarKeyVal cannot add slice if already executed. Warning : panic if called after execution.

func (*CmdOnce) AddEnvVarsHashmap

func (it *CmdOnce) AddEnvVarsHashmap(
	hashmap *corestr.Hashmap,
) *CmdOnce

AddEnvVarsHashmap cannot add slice if already executed. Warning : panic if called after execution.

func (*CmdOnce) AddEnvVarsSlice

func (it *CmdOnce) AddEnvVarsSlice(
	slice ...string,
) *CmdOnce

AddEnvVarsSlice cannot add slice if already executed. Warning : panic if called after execution. Data needs to be in this format "MY_VAR=some_value"

func (*CmdOnce) Arguments

func (it *CmdOnce) Arguments() []string

func (*CmdOnce) ArgumentsSingleLine

func (it *CmdOnce) ArgumentsSingleLine() string

ArgumentsSingleLine Arguments Compiled using Space

func (*CmdOnce) Clone

func (it *CmdOnce) Clone() *CmdOnce

Clone calls constructor NewCmdOnce to create itself using the existing data.

func (*CmdOnce) CloneCmd

func (it *CmdOnce) CloneCmd(isUseStd bool) *exec.Cmd

CloneCmd Clones and creates a new cmd

If isUseStd true then it will clone it self and returns the cmd and buffer will be created and injected,

or else it will heavily depends on CompiledOutput or CombinedOutput

func (*CmdOnce) CmdCloneCompiledOutputBytes added in v0.7.9

func (it *CmdOnce) CmdCloneCompiledOutputBytes() (cmd *exec.Cmd, allBytes []byte, err error)

func (*CmdOnce) CmdCloneCompiledOutputString added in v0.7.9

func (it *CmdOnce) CmdCloneCompiledOutputString() (fullOutput corestr.SimpleStringOnce, err error)

func (*CmdOnce) CmdCloneCompiledOutputStringLines added in v0.7.9

func (it *CmdOnce) CmdCloneCompiledOutputStringLines() (fullOutputLines []string, err error)

func (*CmdOnce) CmdCloneCompiledOutputTrimStringLines added in v0.7.9

func (it *CmdOnce) CmdCloneCompiledOutputTrimStringLines() (fullOutputLines []string, err error)

func (*CmdOnce) CmdCloneUsingStds added in v0.7.9

func (it *CmdOnce) CmdCloneUsingStds(
	outBuff, errBuff *bytes.Buffer,
) *exec.Cmd

func (*CmdOnce) CmdCloneWithoutStd added in v0.7.9

func (it *CmdOnce) CmdCloneWithoutStd() *exec.Cmd

func (*CmdOnce) CommandLine

func (it *CmdOnce) CommandLine() string

CommandLine Gets commandline based on security. if receiver.hasSecureData then only returns process name

func (*CmdOnce) CompiledError

func (it *CmdOnce) CompiledError() string

CompiledError returns lazy once result.

Developer may check:

  • IsSuccessfullyExecuted() reveals if any issue after compile, thus runs the compile or RunOnce() first then returns bool. Or,
  • HasAnyIssues() reveals if any issue after compile, thus runs the compile or RunOnce() first then returns bool. Or,
  • isAlreadyRan() reveals already executed or not. Doesn't run the process. Or,
  • HasCmd() reveals if cmd is nil or not. Or,
  • HasIssues() reveals any issues before running cmd. Or,
  • CompiledErrorWrapper() to check the final error condition.

func (*CmdOnce) CompiledErrorBytes

func (it *CmdOnce) CompiledErrorBytes() []byte

CompiledErrorBytes returns lazy once result.

Developer may check:

  • IsSuccessfullyExecuted() reveals if any issue after compile, thus runs the compile or RunOnce() first then returns bool. Or,
  • HasAnyIssues() reveals if any issue after compile, thus runs the compile or RunOnce() first then returns bool. Or,
  • isAlreadyRan() reveals already executed or not. Doesn't run the process. Or,
  • HasCmd() reveals if cmd is nil or not. Or,
  • HasIssues() reveals any issues before running cmd. Or,
  • CompiledErrorWrapper() to check the final error condition.

func (*CmdOnce) CompiledErrorLines

func (it *CmdOnce) CompiledErrorLines() []string

CompiledErrorLines returns lazy once result.

Developer may check:

  • IsSuccessfullyExecuted() reveals if any issue after compile, thus runs the compile or RunOnce() first then returns bool. Or,
  • HasAnyIssues() reveals if any issue after compile, thus runs the compile or RunOnce() first then returns bool. Or,
  • isAlreadyRan() reveals already executed or not. Doesn't run the process. Or,
  • HasCmd() reveals if cmd is nil or not. Or,
  • HasIssues() reveals any issues before running cmd. Or,
  • CompiledErrorWrapper() to check the final error condition.

func (*CmdOnce) CompiledErrorWrapper

func (it *CmdOnce) CompiledErrorWrapper() *errorwrapper.Wrapper

CompiledErrorWrapper Runs cmdone RunOnce then returns the final compiled error

func (*CmdOnce) CompiledOutput

func (it *CmdOnce) CompiledOutput() string

CompiledOutput returns lazy once result.

Developer may check:

  • IsSuccessfullyExecuted() reveals if any issue after compile, thus runs the compile or RunOnce() first then returns bool. Or,
  • HasAnyIssues() reveals if any issue after compile, thus runs the compile or RunOnce() first then returns bool. Or,
  • isAlreadyRan() reveals already executed or not. Doesn't run the process. Or,
  • HasCmd() reveals if cmd is nil or not. Or,
  • HasIssues() reveals any issues before running cmd. Or,
  • CompiledErrorWrapper() to check the final error condition.

func (*CmdOnce) CompiledOutputBytes

func (it *CmdOnce) CompiledOutputBytes() []byte

CompiledOutputBytes returns lazy once result.

Developer may check:

  • IsSuccessfullyExecuted() reveals if any issue after compile, thus runs the compile or RunOnce() first then returns bool. Or,
  • HasAnyIssues() reveals if any issue after compile, thus runs the compile or RunOnce() first then returns bool. Or,
  • isAlreadyRan() reveals already executed or not. Doesn't run the process. Or,
  • HasCmd() reveals if cmd is nil or not. Or,
  • HasIssues() reveals any issues before running cmd. Or,
  • CompiledErrorWrapper() to check the final error condition.

func (*CmdOnce) CompiledOutputLines

func (it *CmdOnce) CompiledOutputLines() []string

CompiledOutputLines returns lazy once result.

Developer may check:

  • IsSuccessfullyExecuted() reveals if any issue after compile, thus runs the compile or RunOnce() first then returns bool. Or,
  • HasAnyIssues() reveals if any issue after compile, thus runs the compile or RunOnce() first then returns bool. Or,
  • isAlreadyRan() reveals already executed or not. Doesn't run the process. Or,
  • HasCmd() reveals if cmd is nil or not. Or,
  • HasIssues() reveals any issues before running cmd. Or,
  • CompiledErrorWrapper() to check the final error condition.

func (*CmdOnce) CompiledResult

func (it *CmdOnce) CompiledResult() *Result

CompiledResult RunOnce and submits the compiled result structure.

func (*CmdOnce) CompiledTrimmedErrorLines

func (it *CmdOnce) CompiledTrimmedErrorLines() []string

CompiledTrimmedErrorLines returns lazy once result.

Developer may check:

  • IsSuccessfullyExecuted() reveals if any issue after compile, thus runs the compile or RunOnce() first then returns bool. Or,
  • HasAnyIssues() reveals if any issue after compile, thus runs the compile or RunOnce() first then returns bool. Or,
  • isAlreadyRan() reveals already executed or not. Doesn't run the process. Or,
  • HasCmd() reveals if cmd is nil or not. Or,
  • HasIssues() reveals any issues before running cmd. Or,
  • CompiledErrorWrapper() to check the final error condition.

func (*CmdOnce) CompiledTrimmedOutputLines

func (it *CmdOnce) CompiledTrimmedOutputLines() []string

CompiledTrimmedOutputLines returns lazy once result.

Developer may check:

  • IsSuccessfullyExecuted() reveals if any issue after compile, thus runs the compile or RunOnce() first then returns bool. Or,
  • HasAnyIssues() reveals if any issue after compile, thus runs the compile or RunOnce() first then returns bool. Or,
  • isAlreadyRan() reveals already executed or not. Doesn't run the process. Or,
  • HasCmd() reveals if cmd is nil or not. Or,
  • HasIssues() reveals any issues before running cmd. Or,
  • CompiledErrorWrapper() to check the final error condition.

func (*CmdOnce) Dispose added in v0.7.9

func (it *CmdOnce) Dispose()

func (*CmdOnce) DoubleQuoteWholeCommandLine

func (it *CmdOnce) DoubleQuoteWholeCommandLine() string

DoubleQuoteWholeCommandLine Process + Space + ArgumentsCompiledWithSpace

func (*CmdOnce) GetCommandLineDataDependingOnSecurity added in v0.5.8

func (it *CmdOnce) GetCommandLineDataDependingOnSecurity() string

func (*CmdOnce) GetFormattedKeyValueData

func (it *CmdOnce) GetFormattedKeyValueData(
	varName string,
	varValue string,
) string

GetFormattedKeyValueData "MY_VAR=some_value"

func (*CmdOnce) HasAnyIssues

func (it *CmdOnce) HasAnyIssues() bool

HasAnyIssues executes run command and Gets the compile result and check if any compilation error Any issues include compile or cmd running error.

func (*CmdOnce) HasCmd

func (it *CmdOnce) HasCmd() bool

func (*CmdOnce) HasCompiledError

func (it *CmdOnce) HasCompiledError() bool

func (*CmdOnce) HasIssues

func (it *CmdOnce) HasIssues() bool

HasIssues reveals either cmd is nil or has any other cmd initialize error but it doesn't conclude running issues.

func (*CmdOnce) IsAlreadyRan

func (it *CmdOnce) IsAlreadyRan() bool

func (*CmdOnce) IsNull

func (it *CmdOnce) IsNull() bool

func (*CmdOnce) IsSuccessfullyExecuted

func (it *CmdOnce) IsSuccessfullyExecuted() bool

IsSuccessfullyExecuted Runs the execution and then returns the success result.

Reveals if any issue after compile, thus runs the compile or RunOnce() first then returns bool.

func (*CmdOnce) NewArgs

func (it *CmdOnce) NewArgs(additionalArgs ...string) *CmdOnce

func (*CmdOnce) ProcessName

func (it *CmdOnce) ProcessName() string

func (*CmdOnce) Run

func (it *CmdOnce) Run() *Result

Run non lazy and runs as many times called.

Warning: Costly operation, run it wisely.

Under the hood, it creates the same cmdOnce and call it's RunOnce.

func (*CmdOnce) RunOnce

func (it *CmdOnce) RunOnce() *Result

RunOnce only runs once the process and returns the cached data many times.

func (*CmdOnce) RunOnceWithSuccessFlag

func (it *CmdOnce) RunOnceWithSuccessFlag() (cmdResult *Result, isSuccess bool)

RunOnceWithSuccessFlag Runs the process then returns the isSuccess flag

func (*CmdOnce) String

func (it *CmdOnce) String() string

String()

If cmd is present and HasIssues false then it will call RunOnce and get the output and returns it.

func (*CmdOnce) WholeCommandLine

func (it *CmdOnce) WholeCommandLine() string

WholeCommandLine Process + Space + ArgumentsCompiledWithSpace

type CmdOnceCollection added in v0.5.8

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

func BashScriptsLinesCmdOneCollection added in v0.5.9

func BashScriptsLinesCmdOneCollection(
	isTrimEmptyLines bool,
	scriptLines ...string,
) *CmdOnceCollection

func NewCmdOnceCollection added in v0.5.8

func NewCmdOnceCollection(capacity int) *CmdOnceCollection

func NewCmdOnceCollection2 added in v0.5.9

func NewCmdOnceCollection2() *CmdOnceCollection

func NewCmdOnceCollectionUsingLines added in v0.5.9

func NewCmdOnceCollectionUsingLines(
	scriptType scripttype.Variant,
	isTrimEmptyLines bool,
	scriptLines ...string,
) *CmdOnceCollection

func NewCmdOnceCollectionUsingLinesDirect added in v0.5.9

func NewCmdOnceCollectionUsingLinesDirect(
	scriptType scripttype.Variant,
	isTrimEmptyLines bool,
	scriptLines ...string,
) *CmdOnceCollection

func NewCmdOnceCollectionUsingLinesOfScripts added in v0.6.5

func NewCmdOnceCollectionUsingLinesOfScripts(
	scriptType scripttype.Variant,
	scriptLines ...string,
) *CmdOnceCollection

func NewCmdOnceCollectionUsingLinesPtr added in v0.5.9

func NewCmdOnceCollectionUsingLinesPtr(
	scriptType scripttype.Variant,
	isTrimEmptyLines bool,
	scriptLines *[]string,
) *CmdOnceCollection

func (*CmdOnceCollection) Add added in v0.5.8

func (it *CmdOnceCollection) Add(
	cmdOnce *CmdOnce,
) *CmdOnceCollection

func (*CmdOnceCollection) AddBashArgs added in v0.5.8

func (it *CmdOnceCollection) AddBashArgs(
	args ...string,
) *CmdOnceCollection

func (*CmdOnceCollection) AddBashChangeDirArgs added in v0.5.8

func (it *CmdOnceCollection) AddBashChangeDirArgs(
	changeDir string,
	args ...string,
) *CmdOnceCollection

func (*CmdOnceCollection) AddBashChangeDirScripts added in v0.5.8

func (it *CmdOnceCollection) AddBashChangeDirScripts(
	changeDir string,
	scripts ...string,
) *CmdOnceCollection

func (*CmdOnceCollection) AddBashEachScriptAsEachCmdOnce added in v0.5.9

func (it *CmdOnceCollection) AddBashEachScriptAsEachCmdOnce(
	scriptLines ...string,
) *CmdOnceCollection

func (*CmdOnceCollection) AddDefaultScript added in v0.5.8

func (it *CmdOnceCollection) AddDefaultScript(
	scriptType scripttype.Variant,
	scriptsLines ...string,
) *CmdOnceCollection

AddDefaultScript joins using SingleLineScriptsJoiner whereas args joins using space

func (*CmdOnceCollection) AddDefaultScriptArgs added in v0.5.8

func (it *CmdOnceCollection) AddDefaultScriptArgs(
	scriptType scripttype.Variant,
	args ...string,
) *CmdOnceCollection

AddDefaultScriptArgs args joins with space and whereas Scripts joins with SingleLineScriptsJoiner

func (*CmdOnceCollection) AddEachScriptAsEachCmdOnce added in v0.5.9

func (it *CmdOnceCollection) AddEachScriptAsEachCmdOnce(
	scriptType scripttype.Variant,
	scriptLines ...string,
) *CmdOnceCollection

func (*CmdOnceCollection) AddEachScriptAsEachCmdOncePtr added in v0.5.9

func (it *CmdOnceCollection) AddEachScriptAsEachCmdOncePtr(
	scriptType scripttype.Variant,
	scriptLines *[]string,
) *CmdOnceCollection

func (*CmdOnceCollection) AddMany added in v0.5.8

func (it *CmdOnceCollection) AddMany(
	cmdOnceItems ...*CmdOnce,
) *CmdOnceCollection

func (*CmdOnceCollection) AsBasicSliceContractsBinder added in v0.5.8

func (it *CmdOnceCollection) AsBasicSliceContractsBinder() coreinterface.BasicSlicerContractsBinder

func (*CmdOnceCollection) AsBasicSlicerContractsBinder added in v0.5.8

func (it *CmdOnceCollection) AsBasicSlicerContractsBinder() coreinterface.BasicSlicerContractsBinder

func (*CmdOnceCollection) Clear added in v0.7.9

func (it *CmdOnceCollection) Clear() *CmdOnceCollection

func (*CmdOnceCollection) Clone added in v0.5.9

func (it *CmdOnceCollection) Clone() *CmdOnceCollection

func (*CmdOnceCollection) CommandsStrings added in v0.5.8

func (it *CmdOnceCollection) CommandsStrings() []string

func (*CmdOnceCollection) CompiledOneErrorWrapper added in v0.5.8

func (it *CmdOnceCollection) CompiledOneErrorWrapper() *errorwrapper.Wrapper

func (*CmdOnceCollection) Count added in v0.5.8

func (it *CmdOnceCollection) Count() int

func (*CmdOnceCollection) Dispose added in v0.7.9

func (it *CmdOnceCollection) Dispose()

func (*CmdOnceCollection) ErrorWrappers added in v0.5.8

func (it *CmdOnceCollection) ErrorWrappers() []*errorwrapper.Wrapper

func (*CmdOnceCollection) ExecuteAll added in v0.5.9

func (it *CmdOnceCollection) ExecuteAll() *errorwrapper.Wrapper

func (*CmdOnceCollection) ExecuteAllWithoutLazy added in v0.5.9

func (it *CmdOnceCollection) ExecuteAllWithoutLazy() *errorwrapper.Wrapper

func (*CmdOnceCollection) ExecuteAllWithoutLazyResults added in v0.5.9

func (it *CmdOnceCollection) ExecuteAllWithoutLazyResults() []*Result

func (*CmdOnceCollection) ExecuteUntilErr added in v0.5.9

func (it *CmdOnceCollection) ExecuteUntilErr() *errorwrapper.Wrapper

func (*CmdOnceCollection) FailedOutputStringsOnly added in v0.5.8

func (it *CmdOnceCollection) FailedOutputStringsOnly() []string

FailedOutputStringsOnly returns slice of strings output if cmd has failed only

func (*CmdOnceCollection) HasAnyIssuesRunning added in v0.5.8

func (it *CmdOnceCollection) HasAnyIssuesRunning() bool

func (*CmdOnceCollection) HasAnyItem added in v0.5.8

func (it *CmdOnceCollection) HasAnyItem() bool

func (*CmdOnceCollection) HasIndex added in v0.5.8

func (it *CmdOnceCollection) HasIndex(index int) bool

func (*CmdOnceCollection) IsAllSuccess added in v0.5.8

func (it *CmdOnceCollection) IsAllSuccess() bool

func (*CmdOnceCollection) IsEmpty added in v0.5.8

func (it *CmdOnceCollection) IsEmpty() bool

func (*CmdOnceCollection) Items added in v0.5.8

func (it *CmdOnceCollection) Items() []*CmdOnce

func (*CmdOnceCollection) LastIndex added in v0.5.8

func (it *CmdOnceCollection) LastIndex() int

func (*CmdOnceCollection) Length added in v0.5.8

func (it *CmdOnceCollection) Length() int

func (*CmdOnceCollection) OutputsStrings added in v0.5.8

func (it *CmdOnceCollection) OutputsStrings() []string

func (*CmdOnceCollection) Results added in v0.5.8

func (it *CmdOnceCollection) Results() []*Result

func (*CmdOnceCollection) String added in v0.5.8

func (it *CmdOnceCollection) String() string

func (*CmdOnceCollection) Strings added in v0.5.8

func (it *CmdOnceCollection) Strings() []string

func (*CmdOnceCollection) StringsProcessor added in v0.5.8

func (it *CmdOnceCollection) StringsProcessor(
	processor func(cmdOnce *CmdOnce) (processedLine string, isTake, isBreak bool),
) []string

func (*CmdOnceCollection) SuccessStringsOnly added in v0.5.8

func (it *CmdOnceCollection) SuccessStringsOnly() []string

SuccessStringsOnly returns slice of strings output if cmd has success only

type CustomMessage added in v0.6.3

type CustomMessage struct {
	Success, Failed string
}

type Result

type Result struct {
	*BaseBufferStdOutError
	ExitError *exec.ExitError
	ExitCode  int
	// contains filtered or unexported fields
}

func BashArgsResult added in v0.5.1

func BashArgsResult(
	args ...string,
) *Result

func NewResult

func NewResult(
	errorWrapper *errorwrapper.Wrapper,
	stdOut, stdErr *bytes.Buffer,
	exitError *exec.ExitError,
	hasCommandExecuted bool,
) *Result

func NewResultUsingBaseBuffer

func NewResultUsingBaseBuffer(
	errorWrapper *errorwrapper.Wrapper,
	baseBuffer *BaseBufferStdOutError,
	exitError *exec.ExitError,
	hasCommandExecuted bool,
) *Result

func ShellArgsResult added in v0.5.1

func ShellArgsResult(
	args ...string,
) *Result

func ShellScriptsResult added in v0.5.1

func ShellScriptsResult(
	scriptLines ...string,
) *Result

func (*Result) DetailedOutput

func (it *Result) DetailedOutput() string

func (*Result) Dispose added in v0.7.9

func (it *Result) Dispose()

func (*Result) ErrorWrapper

func (it *Result) ErrorWrapper() *errorwrapper.Wrapper

func (*Result) HasCommandExecuted

func (it *Result) HasCommandExecuted() bool

func (*Result) HasError

func (it *Result) HasError() bool

func (*Result) HasExitError

func (it *Result) HasExitError() bool

func (*Result) HasValidExitCode added in v0.7.3

func (it *Result) HasValidExitCode() bool

func (*Result) IsEmptyError

func (it *Result) IsEmptyError() bool

func (*Result) IsExitCode

func (it *Result) IsExitCode(exitCode int) bool

func (*Result) IsExitCodeByte added in v0.7.3

func (it *Result) IsExitCodeByte(exitCode byte) bool

func (*Result) IsInvalidExitCode

func (it *Result) IsInvalidExitCode() bool

func (*Result) IsRunSuccessfully added in v0.7.3

func (it *Result) IsRunSuccessfully() bool

func (*Result) String

func (it *Result) String() string

type StdIn added in v0.8.0

type StdIn struct {
	OutBuf, ErrBuf *bytes.Buffer
}

func NewStdIn added in v0.8.0

func NewStdIn(outBufSize, errBuffSize int) *StdIn

func (*StdIn) HasStdErr added in v0.8.0

func (it *StdIn) HasStdErr() bool

func (*StdIn) HasStdOut added in v0.8.0

func (it *StdIn) HasStdOut() bool

func (*StdIn) StdErrString added in v0.8.0

func (it *StdIn) StdErrString() string

func (*StdIn) StdOutString added in v0.8.0

func (it *StdIn) StdOutString() string

Jump to

Keyboard shortcuts

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