-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.go
50 lines (41 loc) · 892 Bytes
/
options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package panyl
const (
PostProcessOrder_First = 0
PostProcessOrder_Last = 10
PostProcessOrder_Default = 5
)
type Option func(p *Processor)
type JobOption func(p *Job)
func WithLineLimit(startLine, lineAmount int) JobOption {
return func(p *Job) {
p.StartLine = startLine
p.LineAmount = lineAmount
}
}
func WithMaxBacklogLines(maxBacklogLines int) JobOption {
return func(p *Job) {
p.MaxBacklogLines = maxBacklogLines
}
}
func WithIncludeSource(includeSource bool) JobOption {
return func(p *Job) {
p.IncludeSource = includeSource
}
}
func WithLogger(logger Log) Option {
return func(p *Processor) {
p.Logger = logger
}
}
func WithPlugin(plugin Plugin) Option {
return func(p *Processor) {
p.RegisterPlugin(plugin)
}
}
func WithPlugins(plugin ...Plugin) Option {
return func(p *Processor) {
for _, pl := range plugin {
p.RegisterPlugin(pl)
}
}
}