add 'test filesystems' subcommand for testing filesystem filters

This commit is contained in:
Christian Schwarz
2018-10-13 15:53:52 +02:00
parent 5c3c83b2cb
commit 63169c51b7
5 changed files with 145 additions and 3 deletions
+22
View File
@@ -17,10 +17,32 @@ type Config struct {
Global *Global `yaml:"global,optional,fromdefaults"`
}
func (c *Config) Job(name string) (*JobEnum, error) {
for _, j := range c.Jobs {
if j.Name() == name {
return &j, nil
}
}
return nil, fmt.Errorf("job %q not defined in config", name)
}
type JobEnum struct {
Ret interface{}
}
func (j JobEnum) Name() string {
var name string
switch v := j.Ret.(type) {
case *PushJob: name = v.Name
case *SinkJob: name = v.Name
case *PullJob: name = v.Name
case *SourceJob: name = v.Name
default:
panic(fmt.Sprintf("unknownn job type %T", v))
}
return name
}
type ActiveJob struct {
Type string `yaml:"type"`
Name string `yaml:"name"`