processors

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotProcessable = errors.New("not a processable file")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	// FileExtensions are the file extensions this processor should handle
	FileExtensions []string

	// FileNames are specific files this processor should handle
	FileNames []string

	// IsPostCodegenProcessor denotes whether or not the given processor
	// should be ran after the codegen stage of stencil. The main difference
	// between running a processor during the codegen stage and after the
	// codegen stage are the files each touches, respectively. The codegen
	// processors will only touch non-static files generated by stencil,
	// whereas post-codegen processors will touch every file of the repository,
	// regardless of whether or not it was generated by stencil or not.
	// Template does not get passed to Process function (see Processor
	// interface) when this bool is set to true.
	IsPostCodegenProcessor bool
}

type File

type File struct {
	io.Reader

	Name string
}

func NewFile

func NewFile(r io.Reader, path string) *File

NewFile create a new file. If r is nil, a nil file is returned

type GoBox

type GoBox struct{}

GoBox implements the processors.Processor interface to facilitate the migration from the go-outreach repository as a dependency to gobox.

func (*GoBox) Process

func (g *GoBox) Process(orig, _ *File) (*File, error)

Process runs the GoBox processor.

func (*GoBox) Register

func (g *GoBox) Register() *Config

Register returns the Config for the GoBox proecssor.

type GoMod

type GoMod struct{}

func (*GoMod) Process

func (g *GoMod) Process(orig, template *File) (*File, error)

func (*GoMod) Register

func (g *GoMod) Register() *Config

type Processor

type Processor interface {
	// Register configures this processor and returns the config object for it.
	Register() *Config

	// Process process a file and returns it
	Process(*File, *File) (*File, error)
}

type Table

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

func New

func New() *Table

New creates a new processor

func (*Table) Process

func (t *Table) Process(postCodegen bool, existing, template *File) (*File, error)

Process process a file

Jump to

Keyboard shortcuts

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