* This file creates an example config file: unpackerr.conf.example */
(config *Config, output, dir string)
| 12 | /* This file creates an example config file: unpackerr.conf.example */ |
| 13 | |
| 14 | func createConfFile(config *Config, output, dir string) { |
| 15 | buf := bytes.Buffer{} |
| 16 | |
| 17 | // Loop the 'Order' list. |
| 18 | for _, section := range config.Order { |
| 19 | // If Order contains a missing section, bail. |
| 20 | if config.Sections[section] == nil { |
| 21 | log.Fatalln(section + ": in order, but missing from sections. This is a bug in definitions.yml.") |
| 22 | } |
| 23 | |
| 24 | if config.Defs[section] != nil { |
| 25 | buf.WriteString(config.Sections[section].makeDefinedSection(config.Defs[section], config.DefOrder[section], false)) |
| 26 | } else { |
| 27 | buf.WriteString(config.Sections[section].makeSection(section, false, false)) |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | writeFile(dir, output, &buf) |
| 32 | } |
| 33 | |
| 34 | // Not all sections have defs, and it may be nil. Defs only work on 'list' sections. |
| 35 | func (h *Header) makeSection(name section, showHeader, showValue bool) string { |
no test coverage detected