-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtargets.go
31 lines (25 loc) · 936 Bytes
/
targets.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
package wildcat
import (
"github.com/tamada/wildcat/errors"
)
// Config is the configuration object for counting.
type Config struct {
ignore Ignore
readOpts *ReadOptions
runtimeOpts *RuntimeOptions
ec *errors.Center
}
// NewConfig creates an instance of Config.
func NewConfig(ignore Ignore, opts *ReadOptions, runtimeOpts *RuntimeOptions, ec *errors.Center) *Config {
return &Config{ignore: ignore, readOpts: opts, ec: ec, runtimeOpts: runtimeOpts}
}
func (config *Config) updateOpts(newOpts *ReadOptions) *Config {
return NewConfig(config.ignore, newOpts, config.runtimeOpts, config.ec)
}
func (config *Config) updateIgnore(newIgnore Ignore) *Config {
return NewConfig(newIgnore, config.readOpts, config.runtimeOpts, config.ec)
}
// IsIgnore checks given line is the ignored file or not.
func (config *Config) IsIgnore(line string) bool {
return config.ignore != nil && config.ignore.IsIgnore(line)
}