From 51bd6e455dea5c22f8a5c4d1579c472c4937e8d6 Mon Sep 17 00:00:00 2001 From: Silvan Jegen Date: Sun, 22 Jan 2017 16:17:34 +0100 Subject: Use registry for output modules --- output/interface.go | 7 ------- output/outputinterface.go | 7 +++++++ output/stdout.go | 14 -------------- output/stdout/stdout.go | 24 ++++++++++++++++++++++++ 4 files changed, 31 insertions(+), 21 deletions(-) delete mode 100644 output/interface.go create mode 100644 output/outputinterface.go delete mode 100644 output/stdout.go create mode 100644 output/stdout/stdout.go (limited to 'output') diff --git a/output/interface.go b/output/interface.go deleted file mode 100644 index 8f1137a..0000000 --- a/output/interface.go +++ /dev/null @@ -1,7 +0,0 @@ -package output - -import "github.com/Shugyousha/stasher/work" - -type Output interface { - Output(*work.Work) -} diff --git a/output/outputinterface.go b/output/outputinterface.go new file mode 100644 index 0000000..8f1137a --- /dev/null +++ b/output/outputinterface.go @@ -0,0 +1,7 @@ +package output + +import "github.com/Shugyousha/stasher/work" + +type Output interface { + Output(*work.Work) +} 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) +} -- cgit v1.2.3