Documentation
¶
Overview ¶
Package undo provides functionality for undoing stackit operations using snapshots.
Index ¶
- func Action(ctx *app.Context, opts Options, h Handler) error
- type Handler
- type NullHandler
- func (h *NullHandler) Complete(_ bool, _ string)
- func (h *NullHandler) OnSnapshotList(_ []engine.SnapshotInfo)
- func (h *NullHandler) OnStep(_ string, _ handler.StepStatus)
- func (h *NullHandler) PromptConfirm(_ string, _ bool) (bool, error)
- func (h *NullHandler) SelectSnapshot(_ []engine.SnapshotInfo) (string, error)
- func (h *NullHandler) Start()
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Handler ¶
type Handler interface {
// Start is called at the beginning of undo
Start()
// OnSnapshotList is called with available snapshots
OnSnapshotList(snapshots []engine.SnapshotInfo)
// OnStep is called for each undo step
OnStep(description string, status handler.StepStatus)
// Complete is called when undo finishes
Complete(success bool, message string)
// Cleanup restores terminal state (may be no-op)
Cleanup()
// IsInteractive returns true if the handler supports interactive prompts
IsInteractive() bool
// SelectSnapshot prompts user to select a snapshot (interactive only)
SelectSnapshot(snapshots []engine.SnapshotInfo) (string, error)
// PromptConfirm prompts user for confirmation (interactive only)
PromptConfirm(message string, defaultYes bool) (bool, error)
}
Handler receives events from undo action
type NullHandler ¶
NullHandler is a no-op handler for when nil is passed
func (*NullHandler) Complete ¶
func (h *NullHandler) Complete(_ bool, _ string)
Complete implements Handler.
func (*NullHandler) OnSnapshotList ¶
func (h *NullHandler) OnSnapshotList(_ []engine.SnapshotInfo)
OnSnapshotList implements Handler.
func (*NullHandler) OnStep ¶
func (h *NullHandler) OnStep(_ string, _ handler.StepStatus)
OnStep implements Handler.
func (*NullHandler) PromptConfirm ¶
func (h *NullHandler) PromptConfirm(_ string, _ bool) (bool, error)
PromptConfirm implements Handler.
func (*NullHandler) SelectSnapshot ¶
func (h *NullHandler) SelectSnapshot(_ []engine.SnapshotInfo) (string, error)
SelectSnapshot implements Handler.
Click to show internal directories.
Click to hide internal directories.