diffview

package
v0.1.2-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package diffview implements the split-pane local/remote diff screen.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadCmd

func LoadCmd(host config.Host, sel *fs.SelectionState, cfg *config.MergedConfig) tea.Cmd

LoadCmd returns a tea.Cmd that connects to host and loads all diffs asynchronously. Marked directories are expanded recursively; remote-only files inside those directories are detected by walking the remote side as well.

Types

type Model

type Model struct {
	Width  int
	Height int
	// contains filtered or unexported fields
}

Model is the diff view screen.

func New

func New(sessions []diff.Session, host config.Host, conn remote.Client, width, height int) Model

New creates a Model with pre-loaded sessions. syncDirs are pre-filled by autoDir so the user starts with a sensible selection.

func (*Model) Close

func (m *Model) Close()

Close closes the SFTP connection. Call when leaving the diff view.

func (Model) Init

func (m Model) Init() tea.Cmd

Init satisfies the sub-model convention.

func (*Model) SetSize

func (m *Model) SetSize(w, h int)

SetSize updates terminal dimensions.

func (Model) Update

func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)

func (Model) View

func (m Model) View() string

type MsgBackToBrowser

type MsgBackToBrowser struct{}

MsgBackToBrowser is sent when the user quits the diff view.

type MsgBulkSyncDone

type MsgBulkSyncDone struct {
	Done   int      // number of successfully synced files
	Errors []string // one entry per failed file
}

MsgBulkSyncDone is sent when bulk sync has finished.

type MsgDiffError

type MsgDiffError struct{ Err error }

MsgDiffError is sent when SSH/SFTP connection or diff loading fails.

type MsgDiffLoaded

type MsgDiffLoaded struct {
	Sessions []diff.Session
	Conn     remote.Client
}

MsgDiffLoaded is sent when all sessions have been computed. Conn is kept open for subsequent sync operations — caller must close it.

type MsgRefreshed

type MsgRefreshed struct{ Sessions []diff.Session }

MsgRefreshed is sent when a full diff refresh has completed.

type MsgSyncError

type MsgSyncError struct{ Err error }

MsgSyncError is sent when a sync operation fails.

type MsgSynced

type MsgSynced struct {
	SessionIdx int
	Direction  SyncDir
}

MsgSynced is sent after a successful upload or download.

type SyncDir

type SyncDir int

SyncDir indicates the planned sync direction for a file.

const (
	DirNone         SyncDir = iota // — no sync planned (zero value / default)
	DirUpload                      // ↑ push local → remote
	DirDownload                    // ↓ pull remote → local
	DirDeleteLocal                 // ✗ delete the local file
	DirDeleteRemote                // ✗ delete the remote file
)

Jump to

Keyboard shortcuts

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