MCPcopy Create free account
hub / github.com/Unpackerr/unpackerr / createConfFile

Function createConfFile

init/config/config.go:14–32  ·  view source on GitHub ↗

* This file creates an example config file: unpackerr.conf.example */

(config *Config, output, dir string)

Source from the content-addressed store, hash-verified

12/* This file creates an example config file: unpackerr.conf.example */
13
14func 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.
35func (h *Header) makeSection(name section, showHeader, showValue bool) string {

Callers 1

mainFunction · 0.85

Calls 3

writeFileFunction · 0.85
makeDefinedSectionMethod · 0.80
makeSectionMethod · 0.80

Tested by

no test coverage detected