Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FilterFunc ¶
FilterFunc signature
func Expand ¶
func Expand(re *regexp.Regexp, ff ...LookupFunc) FilterFunc
Format returns a filter function that transforms a line by using fmt.Sprintf(format, string(line))
func Format ¶
func Format(format string) FilterFunc
Format returns a filter function that transforms a line by using fmt.Sprintf(format, string(line))
func Grep ¶
func Grep(re *regexp.Regexp, invert bool) FilterFunc
Grep returns a filter function that only let's through matching lines. If invert is true, only non-matching lines are returned.
func Join ¶
func Join() FilterFunc
Join returns a filter function that reads lines from a reader, removes trailing whitespace, joins lines marked with the continuation character (\) and writes the result to a writer. Line numbers are preserved by inserting newlines after continued lines.
func Map ¶
func Map(ff ...MapFunc) FilterFunc
Map returns a filter function that reads lines from a reader, transforms them with the given map functions, and writes the result to a writer.
func PrependSource ¶
func PrependSource(source string) FilterFunc
PrependSource returns a filter function that prepends the given source (with {n} replaced by the current line number), followed by a zero byte to the line. This function must not be reused with other streams to ensure the line count is correct.
type LookupFunc ¶
func LookupEnv ¶
func LookupEnv() LookupFunc
LookupEnv returns a lookup function that uses the current environment as data source.
func LookupMap ¶
func LookupMap(m map[string]string) LookupFunc
LookupMap returns a lookup function that uses the given map as data source.
func LookupStatic ¶
func LookupStatic(val string) LookupFunc
LookupStatic returns a lookup function that returns the given value. If the value contains %s, all occurences will be replaced by the name that is looked up.