Documentation
¶
Index ¶
- func IsLiveOutputOnStdoutEnabled(ctx context.Context) bool
- func WithLiveOutputOnStdout(ctx context.Context) context.Context
- func WithLiveOutputOnStdoutEnabled(ctx context.Context, enabled bool) context.Context
- func WithLiveOutputOnStdoutIfVerbose(ctx context.Context) context.Context
- type BashService
- func (b *BashService) GetDeepCopy() (deepCopy CommandExecutor)
- func (b *BashService) GetHostDescription() (hostDescription string, err error)
- func (b *BashService) RunCommand(ctx context.Context, options *parameteroptions.RunCommandOptions) (commandOutput *CommandOutput, err error)
- func (b *BashService) RunOneLiner(ctx context.Context, oneLiner string) (output *CommandOutput, err error)
- func (b *BashService) RunOneLinerAndGetStdoutAsLines(ctx context.Context, oneLiner string) (stdoutLines []string, err error)
- func (b *BashService) RunOneLinerAndGetStdoutAsString(ctx context.Context, oneLiner string) (stdout string, err error)
- type CommandExecutor
- type CommandExecutorBase
- func (c *CommandExecutorBase) GetParentCommandExecutorForBaseClass() (parentCommandExecutorForBaseClass CommandExecutor, err error)
- func (c *CommandExecutorBase) IsRunningOnLocalhost() (isRunningOnLocalhost bool, err error)
- func (c *CommandExecutorBase) RunCommandAndGetStdoutAsBytes(ctx context.Context, options *parameteroptions.RunCommandOptions) (stdout []byte, err error)
- func (c *CommandExecutorBase) RunCommandAndGetStdoutAsFloat64(ctx context.Context, options *parameteroptions.RunCommandOptions) (stdout float64, err error)
- func (c *CommandExecutorBase) RunCommandAndGetStdoutAsInt64(ctx context.Context, options *parameteroptions.RunCommandOptions) (stdout int64, err error)
- func (c *CommandExecutorBase) RunCommandAndGetStdoutAsLines(ctx context.Context, options *parameteroptions.RunCommandOptions) (stdoutLines []string, err error)
- func (c *CommandExecutorBase) RunCommandAndGetStdoutAsString(ctx context.Context, options *parameteroptions.RunCommandOptions) (stdout string, err error)
- func (c *CommandExecutorBase) SetParentCommandExecutorForBaseClass(parentCommandExecutorForBaseClass CommandExecutor) (err error)
- type CommandOutput
- func (o *CommandOutput) CheckExitSuccess(verbose bool) (err error)
- func (c *CommandOutput) GetCmdRunError() (cmdRunError *error, err error)
- func (o *CommandOutput) GetCmdRunErrorStringOrEmptyStringIfUnset() (cmdRunErrorString string)
- func (c *CommandOutput) GetFirstLineOfStdoutAsString() (firstLine string, err error)
- func (o *CommandOutput) GetReturnCode() (returnCode int, err error)
- func (c *CommandOutput) GetStderr() (stderr *[]byte, err error)
- func (o *CommandOutput) GetStderrAsString() (stderr string, err error)
- func (o *CommandOutput) GetStderrAsStringOrEmptyIfUnset() (stderr string)
- func (c *CommandOutput) GetStdout() (stdout *[]byte, err error)
- func (o *CommandOutput) GetStdoutAsBytes() (stdout []byte, err error)
- func (c *CommandOutput) GetStdoutAsFloat64() (stdout float64, err error)
- func (o *CommandOutput) GetStdoutAsLines(removeLastLineIfEmpty bool) (stdoutLines []string, err error)
- func (o *CommandOutput) GetStdoutAsString() (stdout string, err error)
- func (o *CommandOutput) IsExitSuccess() (isSuccess bool)
- func (c *CommandOutput) IsStderrEmpty() (isEmpty bool, err error)
- func (c *CommandOutput) IsStdoutAndStderrEmpty() (isEmpty bool, err error)
- func (c *CommandOutput) IsStdoutEmpty() (isEmpty bool, err error)
- func (o *CommandOutput) IsTimedOut() (IsTimedOut bool, err error)
- func (c *CommandOutput) LogStdoutAsInfo() (err error)
- func (c *CommandOutput) MustCheckExitSuccess(verbose bool)
- func (c *CommandOutput) MustGetCmdRunError() (cmdRunError *error)
- func (c *CommandOutput) MustGetFirstLineOfStdoutAsString() (firstLine string)
- func (c *CommandOutput) MustGetReturnCode() (returnCode int)
- func (c *CommandOutput) MustGetStderr() (stderr *[]byte)
- func (c *CommandOutput) MustGetStderrAsString() (stdout string)
- func (c *CommandOutput) MustGetStdout() (stdout *[]byte)
- func (c *CommandOutput) MustGetStdoutAsBytes() (stdout []byte)
- func (c *CommandOutput) MustGetStdoutAsFloat64() (stdout float64)
- func (c *CommandOutput) MustGetStdoutAsLines(removeLastLineIfEmpty bool) (stdoutLines []string)
- func (c *CommandOutput) MustGetStdoutAsString() (stdout string)
- func (c *CommandOutput) MustIsStderrEmpty() (isEmpty bool)
- func (c *CommandOutput) MustIsStdoutAndStderrEmpty() (isEmpty bool)
- func (c *CommandOutput) MustIsStdoutEmpty() (isEmpty bool)
- func (c *CommandOutput) MustIsTimedOut() (IsTimedOut bool)
- func (c *CommandOutput) MustLogStdoutAsInfo()
- func (c *CommandOutput) MustSetReturnCode(returnCode int)
- func (c *CommandOutput) MustSetStderr(stderr []byte)
- func (c *CommandOutput) MustSetStderrByString(stderr string)
- func (c *CommandOutput) MustSetStdout(stdout []byte)
- func (c *CommandOutput) MustSetStdoutByString(stdout string)
- func (o *CommandOutput) SetCmdRunError(err error)
- func (o *CommandOutput) SetReturnCode(returnCode int) (err error)
- func (o *CommandOutput) SetStderr(stderr []byte) (err error)
- func (o *CommandOutput) SetStderrByString(stderr string) (err error)
- func (o *CommandOutput) SetStdout(stdout []byte) (err error)
- func (o *CommandOutput) SetStdoutByString(stdout string) (err error)
- type ContextKeyLiveOutputOnStdout
- type ExecService
- type PowerShellService
- func (b *PowerShellService) RunCommand(ctx context.Context, options *parameteroptions.RunCommandOptions) (commandOutput *CommandOutput, err error)
- func (p *PowerShellService) RunOneLiner(ctx context.Context, oneLiner string) (output *CommandOutput, err error)
- func (p *PowerShellService) RunOneLinerAndGetStdoutAsString(ctx context.Context, oneLiner string) (stdout string, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsLiveOutputOnStdoutEnabled ¶ added in v0.300.0
func WithLiveOutputOnStdout ¶ added in v0.300.0
func WithLiveOutputOnStdoutEnabled ¶ added in v0.300.0
Types ¶
type BashService ¶
type BashService struct {
CommandExecutorBase
}
func NewBashService ¶
func NewBashService() (b *BashService)
func (*BashService) GetDeepCopy ¶
func (b *BashService) GetDeepCopy() (deepCopy CommandExecutor)
func (*BashService) GetHostDescription ¶
func (b *BashService) GetHostDescription() (hostDescription string, err error)
func (*BashService) RunCommand ¶
func (b *BashService) RunCommand(ctx context.Context, options *parameteroptions.RunCommandOptions) (commandOutput *CommandOutput, err error)
func (*BashService) RunOneLiner ¶
func (b *BashService) RunOneLiner(ctx context.Context, oneLiner string) (output *CommandOutput, err error)
func (*BashService) RunOneLinerAndGetStdoutAsLines ¶
func (*BashService) RunOneLinerAndGetStdoutAsString ¶
type CommandExecutor ¶
type CommandExecutor interface { GetHostDescription() (hostDescription string, err error) RunCommand(ctx context.Context, options *parameteroptions.RunCommandOptions) (commandOutput *CommandOutput, err error) // These Commands can be implemented by embedding the `CommandExecutorBase` struct: IsRunningOnLocalhost() (isRunningOnLocalhost bool, err error) RunCommandAndGetStdoutAsBytes(ctx context.Context, options *parameteroptions.RunCommandOptions) (stdout []byte, err error) RunCommandAndGetStdoutAsFloat64(ctx context.Context, options *parameteroptions.RunCommandOptions) (stdout float64, err error) RunCommandAndGetStdoutAsInt64(ctx context.Context, options *parameteroptions.RunCommandOptions) (stdout int64, err error) RunCommandAndGetStdoutAsLines(ctx context.Context, options *parameteroptions.RunCommandOptions) (stdoutLines []string, err error) RunCommandAndGetStdoutAsString(ctx context.Context, options *parameteroptions.RunCommandOptions) (stdout string, err error) }
A CommandExecutor is able to run a command like Exec or bash does.
func GetDeepCopyOfCommandExecutor ¶
func GetDeepCopyOfCommandExecutor(commandExectuor CommandExecutor) (copy CommandExecutor, err error)
type CommandExecutorBase ¶
type CommandExecutorBase struct {
// contains filtered or unexported fields
}
func NewCommandExecutorBase ¶
func NewCommandExecutorBase() (c *CommandExecutorBase)
func (*CommandExecutorBase) GetParentCommandExecutorForBaseClass ¶
func (c *CommandExecutorBase) GetParentCommandExecutorForBaseClass() (parentCommandExecutorForBaseClass CommandExecutor, err error)
func (*CommandExecutorBase) IsRunningOnLocalhost ¶
func (c *CommandExecutorBase) IsRunningOnLocalhost() (isRunningOnLocalhost bool, err error)
func (*CommandExecutorBase) RunCommandAndGetStdoutAsBytes ¶
func (c *CommandExecutorBase) RunCommandAndGetStdoutAsBytes(ctx context.Context, options *parameteroptions.RunCommandOptions) (stdout []byte, err error)
func (*CommandExecutorBase) RunCommandAndGetStdoutAsFloat64 ¶
func (c *CommandExecutorBase) RunCommandAndGetStdoutAsFloat64(ctx context.Context, options *parameteroptions.RunCommandOptions) (stdout float64, err error)
func (*CommandExecutorBase) RunCommandAndGetStdoutAsInt64 ¶
func (c *CommandExecutorBase) RunCommandAndGetStdoutAsInt64(ctx context.Context, options *parameteroptions.RunCommandOptions) (stdout int64, err error)
func (*CommandExecutorBase) RunCommandAndGetStdoutAsLines ¶
func (c *CommandExecutorBase) RunCommandAndGetStdoutAsLines(ctx context.Context, options *parameteroptions.RunCommandOptions) (stdoutLines []string, err error)
func (*CommandExecutorBase) RunCommandAndGetStdoutAsString ¶
func (c *CommandExecutorBase) RunCommandAndGetStdoutAsString(ctx context.Context, options *parameteroptions.RunCommandOptions) (stdout string, err error)
func (*CommandExecutorBase) SetParentCommandExecutorForBaseClass ¶
func (c *CommandExecutorBase) SetParentCommandExecutorForBaseClass(parentCommandExecutorForBaseClass CommandExecutor) (err error)
type CommandOutput ¶
type CommandOutput struct { ReturnCode *int Stdout *[]byte Stderr *[]byte // contains filtered or unexported fields }
func NewCommandOutput ¶
func NewCommandOutput() (c *CommandOutput)
func (*CommandOutput) CheckExitSuccess ¶
func (o *CommandOutput) CheckExitSuccess(verbose bool) (err error)
func (*CommandOutput) GetCmdRunError ¶
func (c *CommandOutput) GetCmdRunError() (cmdRunError *error, err error)
func (*CommandOutput) GetCmdRunErrorStringOrEmptyStringIfUnset ¶
func (o *CommandOutput) GetCmdRunErrorStringOrEmptyStringIfUnset() (cmdRunErrorString string)
func (*CommandOutput) GetFirstLineOfStdoutAsString ¶
func (c *CommandOutput) GetFirstLineOfStdoutAsString() (firstLine string, err error)
func (*CommandOutput) GetReturnCode ¶
func (o *CommandOutput) GetReturnCode() (returnCode int, err error)
func (*CommandOutput) GetStderr ¶
func (c *CommandOutput) GetStderr() (stderr *[]byte, err error)
func (*CommandOutput) GetStderrAsString ¶
func (o *CommandOutput) GetStderrAsString() (stderr string, err error)
func (*CommandOutput) GetStderrAsStringOrEmptyIfUnset ¶
func (o *CommandOutput) GetStderrAsStringOrEmptyIfUnset() (stderr string)
func (*CommandOutput) GetStdout ¶
func (c *CommandOutput) GetStdout() (stdout *[]byte, err error)
func (*CommandOutput) GetStdoutAsBytes ¶
func (o *CommandOutput) GetStdoutAsBytes() (stdout []byte, err error)
func (*CommandOutput) GetStdoutAsFloat64 ¶
func (c *CommandOutput) GetStdoutAsFloat64() (stdout float64, err error)
func (*CommandOutput) GetStdoutAsLines ¶
func (o *CommandOutput) GetStdoutAsLines(removeLastLineIfEmpty bool) (stdoutLines []string, err error)
func (*CommandOutput) GetStdoutAsString ¶
func (o *CommandOutput) GetStdoutAsString() (stdout string, err error)
func (*CommandOutput) IsExitSuccess ¶
func (o *CommandOutput) IsExitSuccess() (isSuccess bool)
func (*CommandOutput) IsStderrEmpty ¶
func (c *CommandOutput) IsStderrEmpty() (isEmpty bool, err error)
func (*CommandOutput) IsStdoutAndStderrEmpty ¶
func (c *CommandOutput) IsStdoutAndStderrEmpty() (isEmpty bool, err error)
func (*CommandOutput) IsStdoutEmpty ¶
func (c *CommandOutput) IsStdoutEmpty() (isEmpty bool, err error)
func (*CommandOutput) IsTimedOut ¶
func (o *CommandOutput) IsTimedOut() (IsTimedOut bool, err error)
func (*CommandOutput) LogStdoutAsInfo ¶
func (c *CommandOutput) LogStdoutAsInfo() (err error)
func (*CommandOutput) MustCheckExitSuccess ¶
func (c *CommandOutput) MustCheckExitSuccess(verbose bool)
func (*CommandOutput) MustGetCmdRunError ¶
func (c *CommandOutput) MustGetCmdRunError() (cmdRunError *error)
func (*CommandOutput) MustGetFirstLineOfStdoutAsString ¶
func (c *CommandOutput) MustGetFirstLineOfStdoutAsString() (firstLine string)
func (*CommandOutput) MustGetReturnCode ¶
func (c *CommandOutput) MustGetReturnCode() (returnCode int)
func (*CommandOutput) MustGetStderr ¶
func (c *CommandOutput) MustGetStderr() (stderr *[]byte)
func (*CommandOutput) MustGetStderrAsString ¶
func (c *CommandOutput) MustGetStderrAsString() (stdout string)
func (*CommandOutput) MustGetStdout ¶
func (c *CommandOutput) MustGetStdout() (stdout *[]byte)
func (*CommandOutput) MustGetStdoutAsBytes ¶
func (c *CommandOutput) MustGetStdoutAsBytes() (stdout []byte)
func (*CommandOutput) MustGetStdoutAsFloat64 ¶
func (c *CommandOutput) MustGetStdoutAsFloat64() (stdout float64)
func (*CommandOutput) MustGetStdoutAsLines ¶
func (c *CommandOutput) MustGetStdoutAsLines(removeLastLineIfEmpty bool) (stdoutLines []string)
func (*CommandOutput) MustGetStdoutAsString ¶
func (c *CommandOutput) MustGetStdoutAsString() (stdout string)
func (*CommandOutput) MustIsStderrEmpty ¶
func (c *CommandOutput) MustIsStderrEmpty() (isEmpty bool)
func (*CommandOutput) MustIsStdoutAndStderrEmpty ¶
func (c *CommandOutput) MustIsStdoutAndStderrEmpty() (isEmpty bool)
func (*CommandOutput) MustIsStdoutEmpty ¶
func (c *CommandOutput) MustIsStdoutEmpty() (isEmpty bool)
func (*CommandOutput) MustIsTimedOut ¶
func (c *CommandOutput) MustIsTimedOut() (IsTimedOut bool)
func (*CommandOutput) MustLogStdoutAsInfo ¶
func (c *CommandOutput) MustLogStdoutAsInfo()
func (*CommandOutput) MustSetReturnCode ¶
func (c *CommandOutput) MustSetReturnCode(returnCode int)
func (*CommandOutput) MustSetStderr ¶
func (c *CommandOutput) MustSetStderr(stderr []byte)
func (*CommandOutput) MustSetStderrByString ¶
func (c *CommandOutput) MustSetStderrByString(stderr string)
func (*CommandOutput) MustSetStdout ¶
func (c *CommandOutput) MustSetStdout(stdout []byte)
func (*CommandOutput) MustSetStdoutByString ¶
func (c *CommandOutput) MustSetStdoutByString(stdout string)
func (*CommandOutput) SetCmdRunError ¶
func (o *CommandOutput) SetCmdRunError(err error)
func (*CommandOutput) SetReturnCode ¶
func (o *CommandOutput) SetReturnCode(returnCode int) (err error)
func (*CommandOutput) SetStderr ¶
func (o *CommandOutput) SetStderr(stderr []byte) (err error)
func (*CommandOutput) SetStderrByString ¶
func (o *CommandOutput) SetStderrByString(stderr string) (err error)
func (*CommandOutput) SetStdout ¶
func (o *CommandOutput) SetStdout(stdout []byte) (err error)
func (*CommandOutput) SetStdoutByString ¶
func (o *CommandOutput) SetStdoutByString(stdout string) (err error)
type ContextKeyLiveOutputOnStdout ¶ added in v0.300.0
type ContextKeyLiveOutputOnStdout struct{}
type ExecService ¶
type ExecService struct {
CommandExecutorBase
}
func Exec ¶
func Exec() (e *ExecService)
func NewExec ¶
func NewExec() (e *ExecService)
func NewExecService ¶
func NewExecService() (e *ExecService)
func (*ExecService) GetDeepCopy ¶
func (e *ExecService) GetDeepCopy() (deepCopy CommandExecutor)
func (*ExecService) GetHostDescription ¶
func (e *ExecService) GetHostDescription() (hostDescription string, err error)
func (*ExecService) RunCommand ¶
func (e *ExecService) RunCommand(ctx context.Context, options *parameteroptions.RunCommandOptions) (commandOutput *CommandOutput, err error)
type PowerShellService ¶ added in v0.255.0
type PowerShellService struct {
CommandExecutorBase
}
func NewPowerShell ¶ added in v0.255.0
func NewPowerShell() (p *PowerShellService)
func NewPowerShellService ¶ added in v0.255.0
func NewPowerShellService() (p *PowerShellService)
func PowerShell ¶ added in v0.255.0
func PowerShell() (p *PowerShellService)
func (*PowerShellService) RunCommand ¶ added in v0.255.0
func (b *PowerShellService) RunCommand(ctx context.Context, options *parameteroptions.RunCommandOptions) (commandOutput *CommandOutput, err error)
func (*PowerShellService) RunOneLiner ¶ added in v0.255.0
func (p *PowerShellService) RunOneLiner(ctx context.Context, oneLiner string) (output *CommandOutput, err error)
func (*PowerShellService) RunOneLinerAndGetStdoutAsString ¶ added in v0.255.0
Click to show internal directories.
Click to hide internal directories.