Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultOptions = Options{Context: 10, Color: true}
DefaultOptions are the default options that are used if none are provided.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct { // Context is the number of unchanged lines before and after each changed // block that should also be printed to give some more context on the // change. Context int // Color enables colored diff output. Color bool }
Options control the behaviour and output of the Differ.
type PathDiffer ¶
type PathDiffer struct {
From, To string
}
PathDiffer recursively diffs files in paths.
func NewPathDiffer ¶
func NewPathDiffer(from, to string) *PathDiffer
NewPathDiffer creates a new PathDiffer for the two paths provided. If both paths are files, it will just produce a diff of them. If either of the two is a directory, the differ will recursively walk directories and diff all contained files.
type Printer ¶
type Printer interface { // Print prints a diff for subject s to w. Print(s Subject, w io.Writer) error }
Printer is the interface for a diff printer.
type RemovalDiffer ¶
RemovalDiffer creates a diff for an object removal.
func NewRemovalDiffer ¶
func NewRemovalDiffer(name string, obj runtime.Object) *RemovalDiffer
NewRemovalDiffer creates a new *RemovalDiffer for given obj. The name parameter is used to display a useful name identifying the object in the diff header.
type Subject ¶
Subject holds the contents and filenames to compare. FromFile and ToFile are just used in the diff header to provide some context on what is being diffed.
type UnifiedPrinter ¶
type UnifiedPrinter struct {
Options Options
}
UnifiedPrinter printes unified diffs.
func NewUnifiedPrinter ¶
func NewUnifiedPrinter(o Options) UnifiedPrinter
NewPrinter creates a new unified diff printer with diff options.