diff options
author | Silvan Jegen <s.jegen@gmail.com> | 2017-01-22 16:17:34 +0100 |
---|---|---|
committer | Silvan Jegen <s.jegen@gmail.com> | 2017-01-22 16:17:34 +0100 |
commit | 51bd6e455dea5c22f8a5c4d1579c472c4937e8d6 (patch) | |
tree | a01a17e1b88f7047e45dbbad6dd13275f3a97e34 /output | |
parent | 17a03b66a4a389a13e2187840bb1c1da9041f55b (diff) |
Use registry for output modules
Diffstat (limited to 'output')
-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 |
3 files changed, 24 insertions, 14 deletions
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) +} |