Documentation ¶
Index ¶
- Constants
- func ArgsJoin(args ...string) string
- func ArgsJoinSlice(args []string) string
- func ArgsJoinSlicePtr(args *[]string) string
- func BashArgsErrorWrapper(args ...string) *errorwrapper.Wrapper
- func BashOutput(scriptLines ...string) string
- func BashScriptsErrorWrapper(scriptLines ...string) *errorwrapper.Wrapper
- func ChainCmdSuccess(scriptType scripttype.Variant, scriptLines ...string) (errorWrapper *errorwrapper.Wrapper, isAllSuccess bool)
- func ChangeDirScriptLine(changeDirPath string) string
- func GetScriptOfChangeDirPlusScripts(changeDirPath string, scriptsLines ...string) string
- func IsBashArgsSuccess(args ...string) bool
- func IsBashScriptsSuccess(scriptLines ...string) bool
- func IsShellArgsSuccess(args ...string) bool
- func IsShellScriptsSuccess(scriptLines ...string) bool
- func IsSuccess(scriptType scripttype.Variant, scriptLines ...string) bool
- func IsSuccessBashArgs(args ...string) bool
- func ShellArgsErrorWrapper(args ...string) *errorwrapper.Wrapper
- func ShellOutput(scriptLines ...string) string
- func ShellScriptsErrorWrapper(scriptLines ...string) *errorwrapper.Wrapper
- type BaseBufferStdOutError
- func (receiver *BaseBufferStdOutError) CompiledErrorLines() *[]string
- func (receiver *BaseBufferStdOutError) CompiledOutputLines() *[]string
- func (receiver *BaseBufferStdOutError) CompiledTrimmedErrorLines() *[]string
- func (receiver *BaseBufferStdOutError) CompiledTrimmedErrorOutput() *string
- func (receiver *BaseBufferStdOutError) CompiledTrimmedOutput() *string
- func (receiver *BaseBufferStdOutError) CompiledTrimmedOutputLines() *[]string
- func (receiver *BaseBufferStdOutError) ErrorBytes() *[]byte
- func (receiver *BaseBufferStdOutError) ErrorString() string
- func (receiver *BaseBufferStdOutError) HasErrorBuffer() bool
- func (receiver *BaseBufferStdOutError) HasOutputBuffer() bool
- func (receiver *BaseBufferStdOutError) OutputBytes() *[]byte
- func (receiver *BaseBufferStdOutError) OutputString() string
- type BaseCmdWrapper
- type CmdOnce
- func BashArgs(args ...string) *CmdOnce
- func BashChangeDirPlusRunArgs(changeDirPath string, args ...string) *CmdOnce
- func BashChangeDirPlusRunScripts(changeDirPath string, scriptLines ...string) *CmdOnce
- func BashScripts(scriptLines ...string) *CmdOnce
- func BashScriptsSingleLine(changeDirPath string, scriptLines ...string) *CmdOnce
- func ChangeDirPlusRunScriptsCmdOnce(scriptType scripttype.Variant, changeDirPath string, scriptLines ...string) *CmdOnce
- func NewCmdOnce(hasOutput, hasSecureData bool, process string, arguments ...string) *CmdOnce
- func NewCmdOnceDefault(process string, arguments ...string) *CmdOnce
- func NewCmdOnceNoOutput(process string, arguments ...string) *CmdOnce
- func NewCmdOnceOutput(process string, arguments ...string) *CmdOnce
- func NewCmdOnceUsingCmd(hasOutput, hasSecureData bool, cmd *exec.Cmd) *CmdOnce
- func NewCmdOnceUsingEmpty() *CmdOnce
- func NewCmdOnceUsingScriptType(hasOutput, hasSecureData bool, scriptType scripttype.Variant, ...) *CmdOnce
- func ScriptArgumentsDefault(scriptType scripttype.Variant, args ...string) *CmdOnce
- func ScriptCmdOnceUsingArguments(hasOutput, hasSecureData bool, scriptType scripttype.Variant, args ...string) *CmdOnce
- func ScriptsDefault(scriptType scripttype.Variant, scriptLines ...string) *CmdOnce
- func ShellArgs(args ...string) *CmdOnce
- func ShellScripts(scriptLines ...string) *CmdOnce
- func (receiver *CmdOnce) AddEnvVar(varName, varValue string) *CmdOnce
- func (receiver *CmdOnce) AddEnvVarKeyVal(keyVal corestr.KeyValuePair) *CmdOnce
- func (receiver *CmdOnce) AddEnvVarsHashmap(hashmap *corestr.Hashmap) *CmdOnce
- func (receiver *CmdOnce) AddEnvVarsSlice(slice *[]string) *CmdOnce
- func (receiver *CmdOnce) Arguments() []string
- func (receiver *CmdOnce) ArgumentsSingleLine() string
- func (receiver *CmdOnce) Clone() *CmdOnce
- func (receiver *CmdOnce) CloneCmd(isUseStd bool) *exec.Cmd
- func (receiver *CmdOnce) CommandLine() string
- func (receiver *CmdOnce) CompiledError() string
- func (receiver *CmdOnce) CompiledErrorBytes() *[]byte
- func (receiver *CmdOnce) CompiledErrorLines() *[]string
- func (receiver *CmdOnce) CompiledErrorWrapper() *errorwrapper.Wrapper
- func (receiver *CmdOnce) CompiledOutput() string
- func (receiver *CmdOnce) CompiledOutputBytes() *[]byte
- func (receiver *CmdOnce) CompiledOutputLines() *[]string
- func (receiver *CmdOnce) CompiledResult() *Result
- func (receiver *CmdOnce) CompiledTrimmedErrorLines() *[]string
- func (receiver *CmdOnce) CompiledTrimmedOutputLines() *[]string
- func (receiver *CmdOnce) DoubleQuoteWholeCommandLine() string
- func (receiver *CmdOnce) GetFormattedKeyValueData(varName string, varValue string) string
- func (receiver *CmdOnce) HasAnyIssues() bool
- func (receiver *CmdOnce) HasCmd() bool
- func (receiver *CmdOnce) HasCompiledError() bool
- func (receiver *CmdOnce) HasIssues() bool
- func (receiver *CmdOnce) IsAlreadyRan() bool
- func (receiver *CmdOnce) IsNull() bool
- func (receiver *CmdOnce) IsSuccessfullyExecuted() bool
- func (receiver *CmdOnce) NewArgs(additionalArgs ...string) *CmdOnce
- func (receiver *CmdOnce) ProcessName() string
- func (receiver *CmdOnce) Run() *Result
- func (receiver *CmdOnce) RunOnce() *Result
- func (receiver *CmdOnce) RunOnceWithSuccessFlag() (cmdResult *Result, isSuccess bool)
- func (receiver *CmdOnce) String() string
- func (receiver *CmdOnce) WholeCommandLine() string
- type Result
- func BashArgsResult(args ...string) *Result
- func NewResult(errorWrapper *errorwrapper.Wrapper, stdOut, stdErr *bytes.Buffer, ...) *Result
- func NewResultUsingBaseBuffer(errorWrapper *errorwrapper.Wrapper, baseBuffer *BaseBufferStdOutError, ...) *Result
- func ShellArgsResult(args ...string) *Result
- func ShellScriptsResult(scriptLines ...string) *Result
- func (receiver *Result) DetailedOutput() string
- func (receiver *Result) ErrorWrapper() *errorwrapper.Wrapper
- func (receiver *Result) HasCommandExecuted() bool
- func (receiver *Result) HasError() bool
- func (receiver *Result) HasExitError() bool
- func (receiver *Result) IsEmptyError() bool
- func (receiver *Result) IsExitCode(exitCode int) bool
- func (receiver *Result) IsInvalidExitCode() bool
- func (receiver *Result) String() string
Constants ¶
const ( InvalidExitCode = constants.MinInt ScriptsMultiLineJoiner = " && \\ \n" // " && \\ \n" SingleLineScriptsJoiner = " && " // " && " )
Variables ¶
This section is empty.
Functions ¶
func ArgsJoinSlice ¶ added in v0.5.1
func ArgsJoinSlicePtr ¶ added in v0.5.1
func BashArgsErrorWrapper ¶ added in v0.5.1
func BashArgsErrorWrapper( args ...string, ) *errorwrapper.Wrapper
func BashOutput ¶ added in v0.5.0
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
ChangeDirScriptLine cd path
func GetScriptOfChangeDirPlusScripts ¶ added in v0.5.2
GetScriptOfChangeDirPlusScripts cd path && \ \n scripts...
func IsBashArgsSuccess ¶ added in v0.5.1
func IsBashScriptsSuccess ¶ added in v0.5.1
func IsShellArgsSuccess ¶ added in v0.5.1
func IsShellScriptsSuccess ¶ added in v0.5.1
func IsSuccess ¶ added in v0.5.0
func IsSuccess( scriptType scripttype.Variant, scriptLines ...string, ) bool
func IsSuccessBashArgs ¶ added in v0.5.2
func ShellArgsErrorWrapper ¶ added in v0.5.1
func ShellArgsErrorWrapper( args ...string, ) *errorwrapper.Wrapper
func ShellOutput ¶ added in v0.5.0
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) CompiledErrorLines ¶
func (receiver *BaseBufferStdOutError) CompiledErrorLines() *[]string
func (*BaseBufferStdOutError) CompiledOutputLines ¶
func (receiver *BaseBufferStdOutError) CompiledOutputLines() *[]string
func (*BaseBufferStdOutError) CompiledTrimmedErrorLines ¶
func (receiver *BaseBufferStdOutError) CompiledTrimmedErrorLines() *[]string
func (*BaseBufferStdOutError) CompiledTrimmedErrorOutput ¶
func (receiver *BaseBufferStdOutError) CompiledTrimmedErrorOutput() *string
func (*BaseBufferStdOutError) CompiledTrimmedOutput ¶
func (receiver *BaseBufferStdOutError) CompiledTrimmedOutput() *string
func (*BaseBufferStdOutError) CompiledTrimmedOutputLines ¶
func (receiver *BaseBufferStdOutError) CompiledTrimmedOutputLines() *[]string
func (*BaseBufferStdOutError) ErrorBytes ¶
func (receiver *BaseBufferStdOutError) ErrorBytes() *[]byte
func (*BaseBufferStdOutError) ErrorString ¶
func (receiver *BaseBufferStdOutError) ErrorString() string
func (*BaseBufferStdOutError) HasErrorBuffer ¶
func (receiver *BaseBufferStdOutError) HasErrorBuffer() bool
func (*BaseBufferStdOutError) HasOutputBuffer ¶
func (receiver *BaseBufferStdOutError) HasOutputBuffer() bool
func (*BaseBufferStdOutError) OutputBytes ¶
func (receiver *BaseBufferStdOutError) OutputBytes() *[]byte
func (*BaseBufferStdOutError) OutputString ¶
func (receiver *BaseBufferStdOutError) OutputString() string
type BaseCmdWrapper ¶
type BaseCmdWrapper struct {
// contains filtered or unexported fields
}
type CmdOnce ¶
func BashChangeDirPlusRunArgs ¶ added in v0.5.2
func BashChangeDirPlusRunScripts ¶ added in v0.5.2
func BashScripts ¶ added in v0.5.1
func BashScriptsSingleLine ¶ added in v0.5.2
func ChangeDirPlusRunScriptsCmdOnce ¶ added in v0.5.2
func ChangeDirPlusRunScriptsCmdOnce( scriptType scripttype.Variant, changeDirPath string, scriptLines ...string, ) *CmdOnce
func NewCmdOnce ¶
func NewCmdOnceDefault ¶
func NewCmdOnceNoOutput ¶
func NewCmdOnceOutput ¶
func NewCmdOnceUsingCmd ¶
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 ShellScripts ¶ added in v0.5.1
func (*CmdOnce) AddEnvVar ¶
AddEnvVar cannot add slice if already executed. Warning : panic if called after execution.
func (*CmdOnce) AddEnvVarKeyVal ¶
func (receiver *CmdOnce) AddEnvVarKeyVal(keyVal corestr.KeyValuePair) *CmdOnce
AddEnvVarKeyVal cannot add slice if already executed. Warning : panic if called after execution.
func (*CmdOnce) AddEnvVarsHashmap ¶
AddEnvVarsHashmap cannot add slice if already executed. Warning : panic if called after execution.
func (*CmdOnce) AddEnvVarsSlice ¶
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) ArgumentsSingleLine ¶
ArgumentsSingleLine Arguments Compiled using Space
func (*CmdOnce) Clone ¶
Clone calls constructor NewCmdOnce to create itself using the existing data.
func (*CmdOnce) CloneCmd ¶
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) CommandLine ¶
CommandLine Gets commandline based on security. if receiver.hasSecureData then only returns process name
func (*CmdOnce) CompiledError ¶
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 ¶
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 ¶
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 (receiver *CmdOnce) CompiledErrorWrapper() *errorwrapper.Wrapper
func (*CmdOnce) CompiledOutput ¶
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 ¶
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 ¶
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 ¶
CompiledResult RunOnce and submits the compiled result structure.
func (*CmdOnce) CompiledTrimmedErrorLines ¶
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 ¶
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) DoubleQuoteWholeCommandLine ¶
DoubleQuoteWholeCommandLine Process + Space + ArgumentsCompiledWithSpace
func (*CmdOnce) GetFormattedKeyValueData ¶
GetFormattedKeyValueData "MY_VAR=some_value"
func (*CmdOnce) HasAnyIssues ¶
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) HasCompiledError ¶
func (*CmdOnce) HasIssues ¶
HasIssues reveals either cmd is nil or has any other cmd initialize error but it doesn't conclude running issues.
func (*CmdOnce) IsAlreadyRan ¶
func (*CmdOnce) IsSuccessfullyExecuted ¶
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) ProcessName ¶
func (*CmdOnce) Run ¶
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 ¶
RunOnce only runs once the process and returns the cached data many times.
func (*CmdOnce) RunOnceWithSuccessFlag ¶
RunOnceWithSuccessFlag Runs the process then returns the isSuccess flag
func (*CmdOnce) String ¶
String()
If cmd is present and HasIssues false then it will call RunOnce and get the output and returns it.
func (*CmdOnce) WholeCommandLine ¶
WholeCommandLine Process + Space + ArgumentsCompiledWithSpace
type Result ¶
type Result struct { *BaseBufferStdOutError ExitError *exec.ExitError ExitCode int // contains filtered or unexported fields }
func BashArgsResult ¶ added in v0.5.1
func NewResultUsingBaseBuffer ¶
func NewResultUsingBaseBuffer( errorWrapper *errorwrapper.Wrapper, baseBuffer *BaseBufferStdOutError, exitError *exec.ExitError, hasCommandExecuted bool, ) *Result
func ShellArgsResult ¶ added in v0.5.1
func ShellScriptsResult ¶ added in v0.5.1
func (*Result) DetailedOutput ¶
func (*Result) ErrorWrapper ¶
func (receiver *Result) ErrorWrapper() *errorwrapper.Wrapper
func (*Result) HasCommandExecuted ¶
func (*Result) HasExitError ¶
func (*Result) IsEmptyError ¶
func (*Result) IsExitCode ¶
func (*Result) IsInvalidExitCode ¶
Source Files ¶
- ArgsJoin.go
- ArgsJoinSlice.go
- ArgsJoinSlicePtr.go
- BaseBufferStdOutError.go
- BaseCmdWrapper.go
- BashArgs.go
- BashArgsErrorWrapper.go
- BashArgsResult.go
- BashChangeDirPlusRunArgs.go
- BashChangeDirPlusRunScripts.go
- BashOutput.go
- BashScripts.go
- BashScriptsErrorWrapper.go
- BashScriptsSingleLine.go
- ChainCmdSuccess.go
- ChangeDirPlusRunScriptsCmdOnce.go
- CmdOnce.go
- GetScriptOfChangeDirPlusScripts.go
- IsBashArgsSuccess.go
- IsBashScriptsSuccess.go
- IsShellArgsSuccess.go
- IsShellScriptsSuccess.go
- IsSuccess.go
- IsSuccessBashArgs.go
- Result.go
- ShellArgs.go
- ShellArgsErrorWrapper.go
- ShellArgsResult.go
- ShellOutput.go
- ShellScripts.go
- ShellScriptsErrorWrapper.go
- ShellScriptsResult.go
- changeDirScriptLine.go
- consts.go
- contructors.go
- getNotImplementedCmdOnce.go
- vars.go