undo

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package undo provides undo/redo functionality for CLI operations

Index

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) Clear

func (um *UndoManager) Clear()

Clear clears all history

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL