Documentation
¶
Index ¶
Constants ¶
View Source
const (
DEFAULT_SSH_PORT = 22
)
Variables ¶
This section is empty.
Functions ¶
func ExpandTilde ¶ added in v0.1.4
ExpandTilde expands ~ to the user's home directory using $HOME
Types ¶
type CommandRequest ¶
type CommandRequest struct {
Command string // shell or binary invocation to run
Stdout io.Writer // optional live stdout
Stderr io.Writer // optional live stderr
Stdin io.Reader // optional stdin source
UsePTY bool // request a PTY/TTY when supported
DisableCapture bool // when true, do not retain combined output
}
CommandRequest defines how a command should be executed by an ExecutionClient.
type CommandResult ¶
type CommandResult struct {
Output string // combined stdout+stderr unless capture disabled
ExitCode int
}
CommandResult describes the outcome of a command invocation.
type ExecutionClient ¶
type ExecutionClient interface {
RunCommand(ctx context.Context, req CommandRequest) (CommandResult, error)
CheckPort(ctx context.Context, port string, timeout time.Duration) (bool, error)
Scp(ctx context.Context, remotePath, localPath string) error
Upload(ctx context.Context, localPath, remotePath string) error
Close() error
}
ExecutionClient defines the interface for executing commands on hosts.
func NewLocalClient ¶
func NewLocalClient() ExecutionClient
NewLocalClient creates a new local execution client
func NewSSHClient ¶
func NewSSHClient(host config.Host) (ExecutionClient, error)
Click to show internal directories.
Click to hide internal directories.