knit

package
v0.8.0-beta Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Format tells knit to automatically format Go source code files
	Format bool `yaml:"format"`
	// Verbose tells knit to log more output
	Verbose bool `yaml:"verbose"`
	// Parallel tells knit to process input files in parallel
	Parallel bool `yaml:"parallel"`
}

type Knit

type Knit interface {
	ProcessText(text string) (string, error)
	ProcessFile(filepath string) ProcessResult
	ProcessFiles(filepaths []string, fn OnFileProcessed)
}

func New

func New(cfg *Config) Knit

type OnFileProcessed

type OnFileProcessed = func(res ProcessResult)

OnFileProcessed is a callback function used to notify callers when knit is done processing a file.

type ProcessResult

type ProcessResult struct {
	// The file that was processed
	File string
	// Was the file modified during processing
	Modified bool
	// An error, if any, that occured during processing
	Error error
	// How long it took to process the file
	Time time.Duration
}

ProcessResult represents a file that has been processed by knit

Jump to

Keyboard shortcuts

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