writer

package
v0.0.0-...-c69be4e Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileModeOwnerRWX = 0644
)

Variables

View Source
var (
	ErrNoMatchingClause     = errors.New("no matching clause")
	ErrNoMatchingExpression = errors.New("no matching expression")
)

Functions

This section is empty.

Types

type Inject

type Inject struct {
	Matcher string
	Clause  InjectClause
}

func (*Inject) Validate

func (i *Inject) Validate() error

Validate - exactly 1 clause must be met. Matcher must not be empty

type InjectClause

type InjectClause string
const (
	InjectBefore InjectClause = "Before"
	InjectAfter  InjectClause = "After"
)

type Write

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

func New

func New(dryrun bool) Write

New - create a new writer

func (*Write) AppendFile

func (w *Write) AppendFile(name string, data []byte) error

AppendFile - append data to the end of file

func (*Write) InjectIntoFile

func (w *Write) InjectIntoFile(name string, data []byte, inject Inject) error

InjectIntoFile - inject before, or after a matcher for a source file. If the matcher can't be found, don't do anything to the file

func (*Write) WriteFile

func (w *Write) WriteFile(name string, data []byte, perm fs.FileMode) error

WriteFile thin wrapper to decouple dependency of write file

Jump to

Keyboard shortcuts

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