Documentation
¶
Overview ¶
Package undo provides undo/redo functionality for CLI operations
Index ¶
- type Action
- type ActionSummary
- type UndoManager
- func (um *UndoManager) CanRedo() bool
- func (um *UndoManager) CanUndo() bool
- func (um *UndoManager) Clear()
- func (um *UndoManager) GenerateReport() *UndoReport
- func (um *UndoManager) GetHistory() []Action
- func (um *UndoManager) Record(action Action)
- func (um *UndoManager) Redo() (*Action, error)
- func (um *UndoManager) Undo() (*Action, error)
- type UndoReport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct {
ID string
Command string
Args []string
Description string
Timestamp time.Time
User string
State map[string]interface{}
Rollback func() error
}
Action represents an undoable action
type ActionSummary ¶
type ActionSummary struct {
ID string
Command string
Description string
Timestamp time.Time
User string
}
ActionSummary represents a summary of an action
type UndoManager ¶
type UndoManager struct {
// contains filtered or unexported fields
}
UndoManager manages undo/redo operations
func NewUndoManager ¶
func NewUndoManager(maxHistory int) *UndoManager
NewUndoManager creates a new undo manager
func (*UndoManager) CanRedo ¶
func (um *UndoManager) CanRedo() bool
CanRedo checks if redo is possible
func (*UndoManager) CanUndo ¶
func (um *UndoManager) CanUndo() bool
CanUndo checks if undo is possible
func (*UndoManager) GenerateReport ¶
func (um *UndoManager) GenerateReport() *UndoReport
GenerateReport generates an undo report
func (*UndoManager) GetHistory ¶
func (um *UndoManager) GetHistory() []Action
GetHistory returns the undo history
func (*UndoManager) Record ¶
func (um *UndoManager) Record(action Action)
Record records an action for undo
func (*UndoManager) Redo ¶
func (um *UndoManager) Redo() (*Action, error)
Redo redoes the last undone action
func (*UndoManager) Undo ¶
func (um *UndoManager) Undo() (*Action, error)
Undo undoes the last action
type UndoReport ¶
type UndoReport struct {
TotalActions int
OldestAction time.Time
NewestAction time.Time
Actions []ActionSummary
}
UndoReport generates a report of undo history
Click to show internal directories.
Click to hide internal directories.