Documentation ¶
Index ¶
- type Action
- type Editor
- func Combine(editors ...Editor) Editor
- func Prefix(prefix string, editor Editor) Editor
- func Regexp(re *regexp.Regexp, editor Editor) Editor
- func RegexpString(pattern string, editor Editor) Editor
- func Remove() Editor
- func ReplaceLiteral(replacement string) Editor
- func ReplaceRegexp(re *regexp.Regexp, replacement string) Editor
- func ReplaceRegexpString(pattern string, replacement string) Editor
- type EditorFunc
- type Prefixer
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action byte
Action returns the action that should be performed from the result of an edit.
type Editor ¶
type Editor interface { // Edit edits and returns the provided line as well as a bool when, if true, would // remove the line from output. Edit(line string) (string, Action) }
Editor is an editor for a line.
func Prefix ¶
Prefix returns an Editor that conditionally executes based on whether the line has a prefix matching the specified prefix.
func Regexp ¶
Regexp returns an Editor that conditionally executes based on whether the line matches the regular expression.
func RegexpString ¶
RegexpString is a helper for Regexp. It will panic if the pattern does not compile to a regexp.Regexp.
func Remove ¶
func Remove() Editor
Replace returns an Editor that replaces a line with the provided string.
func ReplaceLiteral ¶
ReplaceLiteral returns an Editor that replaces a line with the provided string.
func ReplaceRegexp ¶
ReplaceLiteral returns an Editor that replaces a line with the provided string.
func ReplaceRegexpString ¶
ReplaceLiteral returns an Editor that replaces a line with the provided string.
type EditorFunc ¶
EditorFunc is a functional implementation of an Editor.
type Prefixer ¶
type Prefixer interface {
Prefix() string
}
Prefixer allows an editor to provide a prefix in order to allow the Writer to optimize selecting the editors to run on a given line.