Documentation
¶
Index ¶
Constants ¶
View Source
const ( ExecutorPowerShell ExecutorName = "powershell.exe" ExecutorPWSH ExecutorName = "pwsh.exe" // refer: https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Core/About/about_PowerShell_exe?view=powershell-5.1#-inputformat-text--xml IOFormatText IOFormat = "Text" IOFormatXML IOFormat = "XML" // refer: https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Core/About/about_execution_policies?view=powershell-5.1#powershell-execution-policies ExecutionPolicyDefault ExecutionPolicy = "Default" ExecutionPolicyAllSigned ExecutionPolicy = "AllSigned" ExecutionPolicyBypass ExecutionPolicy = "Bypass" ExecutionPolicyRemoteSigned ExecutionPolicy = "RemoteSigned" ExecutionPolicyRestricted ExecutionPolicy = "Restricted" ExecutionPolicyUndefined ExecutionPolicy = "Undefined" ExecutionPolicyUnrestricted ExecutionPolicy = "Unrestricted" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateOptions ¶
type CreateOptions struct { Executor ExecutorName // executor of PowerShell. Sta bool // starts PowerShell using a single-threaded apartment. NoProfile bool // does not load the PowerShell profile. InputFormat IOFormat // describes the format of data sent to PowerShell. OutputFormat IOFormat // determines how output from PowerShell is formatted. ConfigurationName string // specifies a configuration endpoint in which PowerShell is run. ExecutionPolicy ExecutionPolicy // sets the default execution policy for the current session and saves it in the `$env:PSExecutionPolicyPreference` environment variable. }
type ExecutionPolicy ¶
type ExecutionPolicy string
type ExecutorName ¶
type ExecutorName string
type PowerShell ¶
type PowerShell struct {
// contains filtered or unexported fields
}
func Create ¶
func Create(session *ssh.Session, opts *CreateOptions) *PowerShell
func (*PowerShell) Commands ¶
func (ps *PowerShell) Commands() (*Commands, error)
Commands holds the input of PowerShell.
func (*PowerShell) ExecuteCommand ¶
func (ps *PowerShell) ExecuteCommand(ctx context.Context, id string, stdout, stderr StdStream, command string) error
ExecuteCommand executes the `command`, this method will be blocked until finish or error occur, returns nil when exit code is 0.
func (*PowerShell) ExecuteScript ¶
func (ps *PowerShell) ExecuteScript(ctx context.Context, id string, stdout, stderr StdStream, scriptPath string, scriptArgs ...string) error
ExecuteScript executes the `scriptPath` script with `scriptArgs`, this method will be blocked until finish or error occur, returns nil when exit code is 0
type WindowStyle ¶
type WindowStyle string
Click to show internal directories.
Click to hide internal directories.