Help us shape the future of Go! Take the 2026 Go Developer Survey

diffview

package
v0.2.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package diffview implements the file-list + unified-diff screen.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadCmd

func LoadCmd(requestID uint64, req app.LoadRequest, prog *progress.Tracker) tea.Cmd

LoadCmd runs app.Load asynchronously and reports MsgDiffLoaded or MsgDiffError. requestID is echoed back in the result so the caller can discard results of requests it has abandoned in the meantime.

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, root *fs.Root, 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) CancelActivity

func (m *Model) CancelActivity()

CancelActivity asks an in-flight sync, refresh, or upload to stop. Work already written is kept; remaining files are left alone.

func (*Model) Close

func (m *Model) Close() tea.Cmd

Close detaches ownership and cancels pending work immediately. Network close may wait for an active operation, so resource cleanup belongs in the command.

func (Model) Connection

func (m Model) Connection() remote.Client

Connection returns the owned connection, even after failure, until Close detaches it.

func (*Model) ConnectionLost

func (m *Model) ConnectionLost(conn remote.Client, err error) bool

ConnectionLost applies only to the current connection. Commands retain their captured handles and report their outcomes; no new work is allowed afterwards.

func (Model) Init

func (m Model) Init() tea.Cmd

Init satisfies the sub-model convention.

func (Model) LoadingActivity

func (m Model) LoadingActivity() (string, *progress.Tracker, bool)

LoadingActivity exposes the current network activity to the root indicator.

func (*Model) SetScope

func (m *Model) SetScope(scope syncpolicy.ScopeSummary, options syncpolicy.ScopeOptions)

SetScope attaches the immutable scope summary used to build these sessions.

func (*Model) SetSize

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

SetSize updates terminal dimensions and keeps the diff viewport in bounds.

func (*Model) SetSyncResult

func (m *Model) SetSyncResult(status string, failures []syncpolicy.Failure)

SetSyncResult restores the result of a transfer across a full scope reload.

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 {
	Conn      remote.Client
	Done      int                  // number of successfully synced files
	Completed []int                // session indices with confirmed successful operations
	Errors    []syncpolicy.Failure // one entry per failed file
	Err       error                // terminal connection failure; remaining jobs were not started
}

MsgBulkSyncDone is sent when bulk sync has finished.

type MsgDiffError

type MsgDiffError struct {
	RequestID uint64
	Host      config.Host
	Err       error
}

MsgDiffError is sent when SSH/SFTP connection or diff loading fails. RequestID and Host identify the failed request, see MsgDiffLoaded.

type MsgDiffLoaded

type MsgDiffLoaded struct {
	RequestID uint64
	Host      config.Host
	Sessions  []diff.Session
	Conn      remote.Client
	Root      *fs.Root // project root for local reads and writes; caller must close it
	Scope     syncpolicy.ScopeSummary
	Options   syncpolicy.ScopeOptions
}

MsgDiffLoaded is sent when all sessions have been computed. Conn is kept open for subsequent sync operations — caller must close it. RequestID and Host identify the LoadCmd call this result belongs to: results can arrive after the app has moved on (another project was opened), and the caller must be able to tell those apart from the result it is waiting for.

type MsgScopeReloadRequested

type MsgScopeReloadRequested struct {
	IncludeIgnored bool
	Status         string
	Errors         []syncpolicy.Failure
	DeletedLocal   []string
	DeletedRemote  []string
}

MsgScopeReloadRequested asks the root model to rebuild the comparison with different recursive ignore handling.

type MsgSyncError

type MsgSyncError struct {
	Conn       remote.Client
	SessionIdx int
	Err        error
}

MsgSyncError is sent when a sync operation fails.

type MsgSyncProgress

type MsgSyncProgress struct {
	Done     int
	Total    int
	Finished bool
}

MsgSyncProgress is emitted periodically while a bulk sync is running.

type MsgSynced

type MsgSynced struct {
	Conn       remote.Client
	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