difffilter

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeDiffPath

func NormalizeDiffPath(diffpath string, strip int) string

NormalizeDiffPath return path normalized path from given path in diff with strip.

Types

type DiffFilter

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

DiffFilter filters lines by diff.

func New

func New(diff []*diff.FileDiff, strip int, cwd string, mode Mode) *DiffFilter

New creates a new DiffFilter.

func (*DiffFilter) ShouldReport

func (df *DiffFilter) ShouldReport(path string, lnum int) (bool, *diff.FileDiff, *diff.Line)

ShouldReport returns true, if the given path should be reported depending on the filter Mode. It also optionally return diff file/line.

type Mode

type Mode int

Mode represents enumeration of available filter modes

const (
	// ModeDefault represents default mode, which means users doesn't specify
	// filter-mode. The behavior can be changed depending on reporters/context
	// later if we want. Basically, it's same as ModeAdded because it's most safe
	// and basic mode for reporters implementation.
	ModeDefault Mode = iota
	// ModeAdded represents filtering by added/changed diff lines.
	ModeAdded
	// ModeDiffContext represents filtering by diff context.
	// i.e. changed lines +-N lines (e.g. N=3 for default git diff).
	ModeDiffContext
	// ModeFile represents filtering by changed files.
	ModeFile
	// ModeNoFilter doesn't filter out any results.
	ModeNoFilter
)

func (*Mode) Set

func (mode *Mode) Set(value string) error

Set implements the flag.Value interface

func (*Mode) String

func (mode *Mode) String() string

String implements the flag.Value interface

Jump to

Keyboard shortcuts

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