diff options
-rw-r--r-- | main.go | 4 | ||||
-rw-r--r-- | output/outputinterface.go (renamed from output/interface.go) | 0 | ||||
-rw-r--r-- | output/stdout.go | 14 | ||||
-rw-r--r-- | output/stdout/stdout.go | 24 | ||||
-rw-r--r-- | registry/registry.go | 8 |
5 files changed, 28 insertions, 22 deletions
@@ -9,7 +9,7 @@ import ( "github.com/Shugyousha/stasher/conf" "github.com/Shugyousha/stasher/filter/str" "github.com/Shugyousha/stasher/input/stdin" - "github.com/Shugyousha/stasher/output" + "github.com/Shugyousha/stasher/output/stdout" ) func main() { @@ -28,7 +28,7 @@ func main() { m := Manager{ Input: stdin.New(nil), Filter: str.New(ffmap), - Output: &output.StdoutOutput{}, + Output: stdout.New(nil), } m.Run() diff --git a/output/interface.go b/output/outputinterface.go index 8f1137a..8f1137a 100644 --- a/output/interface.go +++ b/output/outputinterface.go diff --git a/output/stdout.go b/output/stdout.go deleted file mode 100644 index 5cb753e..0000000 --- a/output/stdout.go +++ /dev/null @@ -1,14 +0,0 @@ -package output - -import ( - "fmt" - - "github.com/Shugyousha/stasher/work" -) - -type StdoutOutput struct { -} - -func (o *StdoutOutput) Output(w *work.Work) { - fmt.Printf("%s\n", w.Data) -} diff --git a/output/stdout/stdout.go b/output/stdout/stdout.go new file mode 100644 index 0000000..9d66581 --- /dev/null +++ b/output/stdout/stdout.go @@ -0,0 +1,24 @@ +package stdout + +import ( + "fmt" + + "github.com/Shugyousha/stasher/output" + "github.com/Shugyousha/stasher/registry" + "github.com/Shugyousha/stasher/work" +) + +func init() { + registry.Outputregistry["stdout"] = New +} + +type StdoutOutput struct { +} + +func New(map[string]string) output.Output { + return &StdoutOutput{} +} + +func (o *StdoutOutput) Output(w *work.Work) { + fmt.Printf("%s\n", w.Data) +} diff --git a/registry/registry.go b/registry/registry.go index 7f0149f..6bb99f0 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -3,15 +3,11 @@ package registry import ( "github.com/Shugyousha/stasher/filter" "github.com/Shugyousha/stasher/input" - "github.com/Shugyousha/stasher/work" + "github.com/Shugyousha/stasher/output" ) var ( Inputregistry map[string]func(map[string]string) input.Input = make(map[string]func(map[string]string) input.Input) Filterregistry map[string]func(map[string]string) filter.Filter = make(map[string]func(map[string]string) filter.Filter) - Outputregistry map[string]func(map[string]string) Output = make(map[string]func(map[string]string) Output) + Outputregistry map[string]func(map[string]string) output.Output = make(map[string]func(map[string]string) output.Output) ) - -type Output interface { - Output(*work.Work) -} |