package write
import "github.com/pkg/diff/write"
Package write provides routines for writing diffs.
Index ¶
Functions ¶
func Unified ¶
Unified writes e to w using unified diff format. ab writes the individual elements. Opts are optional write arguments. Unified returns the number of bytes written and the first error (if any) encountered. Before writing, edit scripts usually have their context reduced, such as by a call to ctxt.Size.
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
An Option modifies behavior when writing a diff.
func Names ¶
Names provides the before/after names for writing a diff. They are traditionally filenames.
func TerminalColor ¶
func TerminalColor() Option
TerminalColor specifies that a diff intended for a terminal should be written using colors.
Do not use TerminalColor if TERM=dumb is set in the environment.
type Pair ¶
type Pair interface { // WriteATo writes the element a[aᵢ] to w. WriteATo(w io.Writer, ai int) (int, error) // WriteBTo writes the element b[bᵢ] to w. WriteBTo(w io.Writer, bi int) (int, error) }
A Pair supports writing a unified diff, element by element. A is the initial state; B is the final state.
Source Files ¶
- Version
- v0.0.0-20241224192749-4e6772a4315c (latest)
- Published
- Dec 24, 2024
- Platform
- windows/amd64
- Imports
- 4 packages
- Last checked
- 3 hours ago –
Tools for package owners.