Documentation
¶
Index ¶
- func BuildCommand(conn *config.Connection, opts *ConnectOptions) []string
- func BuildCommandString(conn *config.Connection, opts *ConnectOptions) string
- func Connect(conn *config.Connection, opts *ConnectOptions) error
- func CountErrors(results []ExecResult) int
- func FormatGroupedOutput(results []ExecResult) string
- func HasErrors(results []ExecResult) bool
- type ConnectOptions
- type ExecOptions
- type ExecResult
- type SSHError
- type TerminalType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildCommand ¶
func BuildCommand(conn *config.Connection, opts *ConnectOptions) []string
func BuildCommandString ¶
func BuildCommandString(conn *config.Connection, opts *ConnectOptions) string
func Connect ¶
func Connect(conn *config.Connection, opts *ConnectOptions) error
func CountErrors ¶
func CountErrors(results []ExecResult) int
CountErrors returns the number of failed executions.
func FormatGroupedOutput ¶
func FormatGroupedOutput(results []ExecResult) string
FormatGroupedOutput formats results in grouped mode.
func HasErrors ¶
func HasErrors(results []ExecResult) bool
HasErrors returns true if any result has an error.
Types ¶
type ConnectOptions ¶
type ExecOptions ¶
type ExecOptions struct {
// Command is the command to execute on remote hosts.
Command string
// Parallel is the maximum number of concurrent connections (default: 10).
Parallel int
// Timeout is the maximum duration for each command (0 means no timeout).
Timeout time.Duration
// FailFast stops execution on the first error if true.
FailFast bool
// Stream enables real-time output streaming with host prefixes.
Stream bool
// DryRun prints commands without executing if true.
DryRun bool
}
ExecOptions configures the behavior of parallel execution.
type ExecResult ¶
type ExecResult struct {
Connection *config.Connection
Stdout string
Stderr string
ExitCode int
Error error
Duration time.Duration
}
ExecResult holds the result of executing a command on a single host.
func Execute ¶
func Execute(connections []config.Connection, opts *ExecOptions) []ExecResult
Execute runs a command on multiple connections in parallel.
func ExecuteContext ¶ added in v1.1.0
func ExecuteContext(parentCtx context.Context, connections []config.Connection, opts *ExecOptions) []ExecResult
ExecuteContext runs a command on multiple connections in parallel, using the provided context for cancellation.
type TerminalType ¶
type TerminalType string
TerminalType represents a detected terminal emulator
const ( TerminalUnknown TerminalType = "unknown" TerminalAppleTerminal TerminalType = "apple-terminal" TerminalITerm2 TerminalType = "iterm2" TerminalWarp TerminalType = "warp" TerminalAlacritty TerminalType = "alacritty" TerminalWindowsTerminal TerminalType = "windows-terminal" TerminalGNOMETerminal TerminalType = "gnome-terminal" TerminalKonsole TerminalType = "konsole" TerminalKitty TerminalType = "kitty" )
func DetectTerminal ¶
func DetectTerminal() TerminalType
DetectTerminal detects the current terminal emulator. It first checks HOP_TERMINAL environment variable, then attempts auto-detection.
func (TerminalType) OpenNewTab ¶
func (t TerminalType) OpenNewTab(command string) error
OpenNewTab opens a new terminal tab/window and runs the given command. The command should be the full SSH command string.
func (TerminalType) String ¶
func (t TerminalType) String() string
String returns a human-readable name for the terminal
func (TerminalType) SupportsNewTab ¶
func (t TerminalType) SupportsNewTab() bool
SupportsNewTab returns true if the terminal supports opening new tabs