Documentation ¶
Index ¶
Constants ¶
View Source
const UnifiedTimeFormat = "2006-01-02 15:04:05.000000000 -0700"
Variables ¶
View Source
var OperationMapForDMP = map[diffmatchpatch.Operation]Operation{ diffmatchpatch.DiffDelete: OperationDelete, diffmatchpatch.DiffInsert: OperationInsert, diffmatchpatch.DiffEqual: OperationEqual, }
Functions ¶
This section is empty.
Types ¶
type Colorizer ¶ added in v0.2.0
type Colorizer struct {
// contains filtered or unexported fields
}
func NewColorizer ¶ added in v0.2.0
type DiffTarget ¶
func NewDiffTarget ¶
func NewDiffTarget(path string) *DiffTarget
func (*DiffTarget) LoadStat ¶
func (t *DiffTarget) LoadStat() error
func (*DiffTarget) ReadText ¶
func (t *DiffTarget) ReadText() (string, error)
type Hunk ¶
type Hunk struct { Diffs []LineDiff OldLineFrom int OldLineTo int OldLineCount int NewLineFrom int NewLineTo int NewLineCount int }
func (*Hunk) AppendDiff ¶
type LineDiff ¶
func MakeLineDiffsFromDMP ¶ added in v0.2.0
func MakeLineDiffsFromDMP(diffs []diffmatchpatch.Diff) []LineDiff
In order to make line diffs from github.com/seri/diffmatchpatch, you can make by steps shown below:
// Computing a line-mode diff by github.com/seri/diffmatchpatch // @see https://github.com/google/diff-match-patch/wiki/Line-or-Word-Diffs dmp := diffmatchpatch.New() runes1, runes2, lineArray := dmp.DiffLinesToRunes(text1, text2) diffs := dmp.DiffMainRunes(runes1, runes2, false) diffs = dmp.DiffCharsToLines(diffs, lineArray) // Make `[]LineDiff` from `[]diffmatchpatch.Diff` lineDiffs := difffmt.MakeLineDiffsFromDMP(diffs)
type UnifiedFormat ¶
type UnifiedFormat struct {
// contains filtered or unexported fields
}
func NewUnifiedFormat ¶ added in v0.2.0
func NewUnifiedFormat(option UnifiedFormatOption) *UnifiedFormat
func (*UnifiedFormat) Fprint ¶
func (u *UnifiedFormat) Fprint(w io.Writer, targetA *DiffTarget, targetB *DiffTarget, hunks []Hunk)
func (*UnifiedFormat) Print ¶
func (u *UnifiedFormat) Print(targetA *DiffTarget, targetB *DiffTarget, hunks []Hunk)
func (*UnifiedFormat) Sprint ¶
func (u *UnifiedFormat) Sprint(targetA *DiffTarget, targetB *DiffTarget, hunks []Hunk) string
type UnifiedFormatOption ¶ added in v0.2.0
Click to show internal directories.
Click to hide internal directories.