Documentation
¶
Overview ¶
Package diff compares local and remote files and produces structured diff results.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RenderPanes ¶
func RenderPanes(result *DiffResult, paneWidth, scrollOffset, count int) (left, right []string)
RenderPanes converts a DiffResult into two parallel slices of rendered strings (left = local, right = remote), each line padded to paneWidth columns. scrollOffset is the first DiffLine index to render; count is the number of rows.
Types ¶
type DiffLine ¶
type DiffLine struct {
LocalLine string
RemoteLine string
Kind LineKind
LocalNum int // 0 = line not present on this side
RemoteNum int
}
DiffLine holds one line of a side-by-side diff.
type DiffResult ¶
type DiffResult struct {
LocalPath string
RemotePath string
Lines []DiffLine
// Existence flags
LocalOnly bool // file exists only locally (not on remote)
RemoteOnly bool // file exists only on remote
// Metadata
Binary bool
SizeLocal int64
SizeRemote int64
ModLocal time.Time
ModRemote time.Time
}
DiffResult is the comparison output for a single file pair.
func Compare ¶
func Compare(localPath, remotePath string, client RemoteClient) (*DiffResult, error)
Compare produces a DiffResult for a local/remote file pair.
func (*DiffResult) HasDiff ¶
func (r *DiffResult) HasDiff() bool
HasDiff returns true if the files differ in any way.
Click to show internal directories.
Click to hide internal directories.