format

package
v0.0.0-...-ea6fe2d Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCommandNotFound = errors.New("formatter command not found in PATH")

ErrCommandNotFound is returned when the Command for a Formatter is not available.

Functions

func CompileGlobs

func CompileGlobs(patterns []string) ([]glob.Glob, error)

CompileGlobs prepares the globs, where the patterns are all right-matching.

func PathMatches

func PathMatches(path string, globs []glob.Glob) bool

Types

type Formatter

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

Formatter represents a command which should be applied to a filesystem.

func NewFormatter

func NewFormatter(
	name string,
	treeRoot string,
	cfg *config.Formatter,
	globalExcludes []glob.Glob,
) (*Formatter, error)

NewFormatter is used to create a new Formatter.

func (*Formatter) Apply

func (f *Formatter) Apply(ctx context.Context, files []*walk.File, filter bool) error

func (*Formatter) Executable

func (f *Formatter) Executable() string

Executable returns the path to the executable defined by Command

func (*Formatter) Wants

func (f *Formatter) Wants(file *walk.File) bool

Wants is used to test if a Formatter wants a path based on it's configured Includes and Excludes patterns. Returns true if the Formatter should be applied to path, false otherwise.

type Pipeline

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

func (*Pipeline) Add

func (p *Pipeline) Add(f *Formatter)

func (*Pipeline) Apply

func (p *Pipeline) Apply(ctx context.Context, paths []*walk.File) error

func (*Pipeline) Wants

func (p *Pipeline) Wants(path *walk.File) bool

Jump to

Keyboard shortcuts

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