blocks

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReaderIgnore

func ReaderIgnore(_ *Reader, _ int, _ string) error

func ReaderPassthrough

func ReaderPassthrough(br *Reader, _ int, line string) error

Types

type BlockWriter added in v0.3.0

type BlockWriter interface {
	Write(index, startLine, endLine int, text string)
	Close() error
}

type Reader

type Reader struct {
	FileName string

	Log *logrus.Logger

	// io
	Reader io.Reader
	Writer io.Writer

	// stats
	LineCount        int // total lines processed
	LinesBlock       int // total block lines processed
	BlockCount       int // total blocks found
	BlockCurrentLine int // current block line count

	CurrentNodeCursor          *astutil.Cursor
	CurrentNodeQuoteChar       string
	CurrentNodeLeadingPadding  string
	CurrentNodeTrailingPadding string

	ErrorBlocks int

	// options
	ReadOnly       bool
	FixFinishLines bool

	// callbacks
	LineRead  func(*Reader, int, string) error
	BlockRead blockReadFunc

	// Only used by the "blocks" command
	BlockWriter BlockWriter
}

func (*Reader) DoTheThing

func (br *Reader) DoTheThing(fs afero.Fs, filename string, stdin io.Reader, stdout io.Writer) error

Jump to

Keyboard shortcuts

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