supportconfig

package module
v0.0.0-...-1a28462 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const FileNotFound = "File not found"

Variables

View Source
var SkipFile = fmt.Errorf("This file must be skipped")

Functions

func ScanLinesIgnoreCR

func ScanLinesIgnoreCR(data []byte, atEOF bool) (advance int, token []byte, err error)

ScanLinesIgnoreCR doesn't strip CR as the default scanner does

Types

type Config

type Config struct {

	// Base destination directory
	Base string

	// FilenameFunc gets a path as in the source file and should return
	// the destination path (later to be joined with the base
	// directory)
	PathHandler PathHandlerFunc
}

Config has settings for the file splitter

type HandlerFunc

type HandlerFunc func(section, next string) (io.WriteCloser, error)

HandlerFunc is the func that is used by HandleSection

type NopWriteCloser

type NopWriteCloser struct {
	bufio.Writer
	// contains filtered or unexported fields
}

func (*NopWriteCloser) Close

func (n *NopWriteCloser) Close() error

type Parser

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

Parser keeps the state of the parsing accross different files

func NewParser

func NewParser() *Parser

NewParser initialiazes a new Parser

func (*Parser) HandleSection

func (p *Parser) HandleSection(section string, handler HandlerFunc)

HandleSection adds a handler to a given slice of handlers for the section found

func (*Parser) Parse

func (p *Parser) Parse(source io.Reader) error

Parse starts reading the source and triggers the events when sections are matched.

type PathHandlerFunc

type PathHandlerFunc func(path string) (newpath string, err error)

PathHandlerFunc says to the splitter what is the filename to be used for a given path

type Splitter

type Splitter struct {
	Config Config
}

Splitter has the state of the splitter

func (*Splitter) Split

func (s *Splitter) Split(source io.Reader) error

Runs the splitter for a reable source

Jump to

Keyboard shortcuts

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