Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Action ¶
type Action struct {
Type ActionType
Key string
Help string
Confirm string // Non-empty if confirmation required
ShellCmd string // For shell actions, the rendered command
SessionID string
SessionPath string
Silent bool // Skip loading popup for fast commands
Exit bool // Exit hive after command completes
Err error // Non-nil if action resolution failed (e.g., template error)
}
Action represents a resolved command action ready for execution.
func (Action) NeedsConfirm ¶
NeedsConfirm returns true if the action requires user confirmation.
type ActionType ¶
type ActionType int
ActionType identifies the kind of action.
const ( ActionTypeNone ActionType = iota ActionTypeRecycle ActionTypeDelete ActionTypeShell )
type DeleteExecutor ¶
type DeleteExecutor struct {
// contains filtered or unexported fields
}
DeleteExecutor executes a session delete operation.
func (*DeleteExecutor) Execute ¶
func (e *DeleteExecutor) Execute(ctx context.Context) (output <-chan string, done <-chan error, cancel context.CancelFunc)
Execute deletes the session asynchronously. Returns nil output channel (non-streaming).
type Executor ¶
type Executor interface {
// Execute runs the command asynchronously. Returns:
// - output: streaming output lines (nil for non-streaming commands)
// - done: receives error (or nil) when complete
// - cancel: cancels the operation
Execute(ctx context.Context) (output <-chan string, done <-chan error, cancel context.CancelFunc)
}
Executor executes a command, optionally with streaming output.
type RecycleExecutor ¶
type RecycleExecutor struct {
// contains filtered or unexported fields
}
RecycleExecutor executes a session recycle operation with streaming output.
func (*RecycleExecutor) Execute ¶
func (e *RecycleExecutor) Execute(ctx context.Context) (output <-chan string, done <-chan error, cancel context.CancelFunc)
Execute starts the recycle operation and returns channels for output and completion. Returns non-nil output channel with streaming recycle progress.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service creates command executors based on action type.
func NewService ¶
func NewService(deleter SessionDeleter, recycler SessionRecycler) *Service
NewService creates a new command service with the given dependencies.
type SessionDeleter ¶
SessionDeleter is the interface for deleting sessions.
type SessionRecycler ¶
type SessionRecycler interface {
RecycleSession(ctx context.Context, id string, w io.Writer) error
}
SessionRecycler is the interface for recycling sessions.
type ShellExecutor ¶
type ShellExecutor struct {
// contains filtered or unexported fields
}
ShellExecutor executes a shell command.
func (*ShellExecutor) Execute ¶
func (e *ShellExecutor) Execute(ctx context.Context) (output <-chan string, done <-chan error, cancel context.CancelFunc)
Execute runs the shell command asynchronously. Returns nil output channel (non-streaming).