diff

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunDiff

func RunDiff(w io.Writer, args []string, opts DiffOptions) error

RunDiff executes the diff command.

Types

type DiffHunk

type DiffHunk struct {
	Start1 int
	Count1 int
	Start2 int
	Count2 int
	Lines  []DiffLine
}

DiffHunk represents a contiguous block of changes.

type DiffLine

type DiffLine struct {
	Type    rune // ' ' for context, '-' for removed, '+' for added
	Content string
}

DiffLine represents a single line in the diff.

type DiffOptions

type DiffOptions struct {
	Unified        int  // Number of context lines for unified diff
	Side           bool // Side-by-side output
	Brief          bool // Report only when files differ
	IgnoreCase     bool // Ignore case differences
	IgnoreSpace    bool // Ignore whitespace differences
	IgnoreBlank    bool // Ignore blank lines
	Recursive      bool // Recursively compare directories
	JSON           bool // Compare as JSON
	Color          bool // Colorize output
	Context        int  // Lines of context (old style)
	Width          int  // Output width for side-by-side
	SuppressCommon bool // Suppress common lines in side-by-side
}

DiffOptions configures the diff command behavior.

type DiffResult

type DiffResult struct {
	File1  string
	File2  string
	Differ bool
	Hunks  []DiffHunk
}

DiffResult represents the result of a diff operation.

Jump to

Keyboard shortcuts

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