diff

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package diff provides a component for displaying before/after comparisons with confirmation dialog for changes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CancelMsg

type CancelMsg struct{}

CancelMsg is sent when user cancels the changes

type ConfirmMsg

type ConfirmMsg struct{}

ConfirmMsg is sent when user confirms the changes

type Field

type Field struct {
	Label    string
	OldValue string
	NewValue string
}

Field represents a single field in the diff

func (Field) IsChanged

func (f Field) IsChanged() bool

IsChanged returns true if the field value has changed

type Viewer

type Viewer struct {
	// contains filtered or unexported fields
}

Viewer displays a diff with confirmation buttons

func New

func New(title string, fields []Field) *Viewer

New creates a new diff viewer

func (*Viewer) HasChanges

func (v *Viewer) HasChanges() bool

HasChanges returns true if any field has changed

func (*Viewer) IsFocusedYes

func (v *Viewer) IsFocusedYes() bool

IsFocusedYes returns true if Yes button is focused

func (*Viewer) SetSize

func (v *Viewer) SetSize(width, height int)

SetSize sets the component dimensions

func (*Viewer) SetWarnings

func (v *Viewer) SetWarnings(warnings []string)

SetWarnings sets warning messages to display

func (*Viewer) Update

func (v *Viewer) Update(msg tea.Msg) tea.Cmd

Update handles user input

func (*Viewer) View

func (v *Viewer) View() string

View renders the diff viewer

Jump to

Keyboard shortcuts

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