diff options
author | Silvan Jegen <s.jegen@gmail.com> | 2017-02-15 12:55:58 +0100 |
---|---|---|
committer | Silvan Jegen <s.jegen@gmail.com> | 2017-02-15 12:56:21 +0100 |
commit | 5147048d4a67c59f799203e1cc5f79b183208cab (patch) | |
tree | b3f8ac1a12b6d164809abc00c1a8dc05ed8ad56c | |
parent | aab7d33eba775fc497e651d8bfb1537980b5d91e (diff) |
Put the Manager in its own package
-rw-r--r-- | conf/parser.go | 8 | ||||
-rw-r--r-- | main.go | 5 | ||||
-rw-r--r-- | manager/manager.go (renamed from manager.go) | 2 |
3 files changed, 7 insertions, 8 deletions
diff --git a/conf/parser.go b/conf/parser.go index 0e19338..29f8968 100644 --- a/conf/parser.go +++ b/conf/parser.go @@ -21,14 +21,12 @@ import ( "io" "os" + "github.com/Shugyousha/stasher/manager" "github.com/Shugyousha/stasher/registry" ) // Having a Config to Manager function could be nice? Or we could just // return a Manager from here which may be even better... -type Config struct { -} - type parser struct { s scanner last token @@ -48,11 +46,11 @@ func newParser(s *scanner) *parser { return p } -func NewConfig(r io.Reader) *Config { +func NewManagerFromConfig(r io.Reader) *manager.Manager { p := newParser(newScanner(r)) p.startparsing() - return &Config{} + return &manager.Manager{} } func (p *parser) startparsing() { @@ -9,6 +9,7 @@ import ( "github.com/Shugyousha/stasher/conf" "github.com/Shugyousha/stasher/filter/str" "github.com/Shugyousha/stasher/input/stdin" + "github.com/Shugyousha/stasher/manager" "github.com/Shugyousha/stasher/output/stdout" ) @@ -19,13 +20,13 @@ func main() { os.Exit(1) } - c := conf.NewConfig(bufio.NewReader(f)) + c := conf.NewManagerFromConfig(bufio.NewReader(f)) fmt.Fprintf(os.Stderr, "config: %#v\n", c) ffmap := make(map[string]func(string) string, 10) ffmap["F"] = func(s string) string { return strings.ToUpper(s) } - m := Manager{ + m := manager.Manager{ Input: stdin.New(nil), Filter: str.New(ffmap), Output: stdout.New(nil), diff --git a/manager.go b/manager/manager.go index d3d38fd..5bbd49f 100644 --- a/manager.go +++ b/manager/manager.go @@ -1,4 +1,4 @@ -package main +package manager import ( "fmt" |