aboutsummaryrefslogtreecommitdiffstats
path: root/formats/config/decoder.go
diff options
context:
space:
mode:
Diffstat (limited to 'formats/config/decoder.go')
-rw-r--r--formats/config/decoder.go37
1 files changed, 0 insertions, 37 deletions
diff --git a/formats/config/decoder.go b/formats/config/decoder.go
deleted file mode 100644
index 0f02ce1..0000000
--- a/formats/config/decoder.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package config
-
-import (
- "io"
-
- "github.com/src-d/gcfg"
-)
-
-// A Decoder reads and decodes config files from an input stream.
-type Decoder struct {
- io.Reader
-}
-
-// NewDecoder returns a new decoder that reads from r.
-func NewDecoder(r io.Reader) *Decoder {
- return &Decoder{r}
-}
-
-// Decode reads the whole config from its input and stores it in the
-// value pointed to by config.
-func (d *Decoder) Decode(config *Config) error {
- cb := func(s string, ss string, k string, v string, bv bool) error {
- if ss == "" && k == "" {
- config.Section(s)
- return nil
- }
-
- if ss != "" && k == "" {
- config.Section(s).Subsection(ss)
- return nil
- }
-
- config.AddOption(s, ss, k, v)
- return nil
- }
- return gcfg.ReadWithCallback(d, cb)
-}