diff

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(args []string) error

Types

type Config

type Config struct {
	Unified        bool   `flag:"" desc:"Use unified diff format"`
	LabelOld       string `flag:"" desc:"Label for old file in diff"`
	LabelNew       string `flag:"" desc:"Label for new file in diff"`
	Recursive      bool   `flag:"" desc:"Compare directories recursively"`
	IgnoreAllSpace bool   `flag:"" desc:"Ignore all whitespace changes"`
	Quiet          bool   `flag:"" desc:"Output only whether files differ"`
	Context        int    `flag:"" desc:"Number of context lines"`
	XML            bool
	JSON           bool
	Plain          bool
	Pretty         bool
}

type DiffError

type DiffError struct {
	XMLName xml.Name `xml:"error"`
	Code    int      `xml:"code,attr"`
	Msg     string   `xml:"msg,attr"`
	Path    string   `xml:"path,attr"`
}

type DiffHunk

type DiffHunk struct {
	XMLName  xml.Name   `xml:"hunk"`
	OldStart int        `xml:"old_start,attr"`
	OldCount int        `xml:"old_count,attr"`
	NewStart int        `xml:"new_start,attr"`
	NewCount int        `xml:"new_count,attr"`
	Lines    []DiffLine `xml:"line"`
}

type DiffLine

type DiffLine struct {
	XMLName xml.Name `xml:"line"`
	Type    string   `xml:"type,attr"`
	Number  int      `xml:"number,attr"`
	Content string   `xml:"content,attr"`
}

type DiffResult

type DiffResult struct {
	XMLName      xml.Name    `xml:"diff"`
	OldFile      string      `xml:"old_file,attr"`
	NewFile      string      `xml:"new_file,attr"`
	OldLabel     string      `xml:"old_label,attr,omitempty"`
	NewLabel     string      `xml:"new_label,attr,omitempty"`
	AddedLines   int         `xml:"added_lines,attr"`
	RemovedLines int         `xml:"removed_lines,attr"`
	ChangedHunks int         `xml:"changed_hunks,attr"`
	Identical    bool        `xml:"identical,attr"`
	Timestamp    int64       `xml:"timestamp,attr"`
	Hunks        []DiffHunk  `xml:"hunk"`
	Errors       []DiffError `xml:"error,omitempty"`
}

Jump to

Keyboard shortcuts

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