Encode writes the config in git config format to the stream of the encoder.
(cfg *Config)
| 22 | |
| 23 | // Encode writes the config in git config format to the stream of the encoder. |
| 24 | func (e *Encoder) Encode(cfg *Config) error { |
| 25 | for _, s := range cfg.Sections { |
| 26 | if err := e.encodeSection(s); err != nil { |
| 27 | return err |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | return nil |
| 32 | } |
| 33 | |
| 34 | func (e *Encoder) encodeSection(s *Section) error { |
| 35 | if len(s.Options) > 0 { |