diff

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Diff

type Diff struct {
	// contains filtered or unexported fields
}

Diff 差异对比结果对象

func (Diff) Clean

func (d Diff) Clean(keep uint) error

Clean 清理保存的状态文件,只保留 keep 个版本 实际上是保留 keep + 1 个版本,始终保留当前版本

func (Diff) PrintAndSave

func (d Diff) PrintAndSave(out io.Writer) error

PrintAndSave 将差异对比信息输出并且保存最后一次状态

func (Diff) Save

func (d Diff) Save() error

Save 保存最后一次状态

func (Diff) String

func (d Diff) String() string

String 返回差异对比结果

type Differ

type Differ struct {
	// contains filtered or unexported fields
}

Differ 文档对比工具

func NewDiffer

func NewDiffer(fs FS, dataDir string, contextLine int) *Differ

NewDiffer create a new Differ

func (Differ) Diff

func (ds Differ) Diff(s1name, s1, s2name, s2 string) string

Diff 文档差异对比

func (Differ) DiffLatest

func (ds Differ) DiffLatest(name string, targetStr string) Diff

DiffLatest 将当前文档与最后一次保存的文档对比

type FS

type FS interface {
	Exist(path string) bool
	WriteFile(path string, data []byte) error
	ReadFile(path string) ([]byte, error)
	ListFiles(dir string) ([]string, error)
	MkDir(path string) error
	Delete(path string) error
}

Jump to

Keyboard shortcuts

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