MCPcopy Index your code
hub / github.com/devspace-sh/devspace / ProcessGroups

Function ProcessGroups

docs/hack/util/groups.go:17–49  ·  view source on GitHub ↗
(groups map[string]*Group)

Source from the content-addressed store, hash-verified

15}
16
17func ProcessGroups(groups map[string]*Group) {
18 for groupID, group := range groups {
19 groupContent := group.Content
20 groupFileContent := ""
21
22 if strings.TrimSpace(group.Content) != "" {
23 if group.Name != "" {
24 groupContent = "\n" + `<div className="group-name">` + group.Name + `</div>` + "\n\n" + groupContent
25 }
26
27 groupImportContent := ""
28 for _, partialFile := range *group.Imports {
29 groupImportContent = groupImportContent + GetPartialImport(partialFile, group.File)
30 }
31
32 if groupImportContent != "" {
33 groupImportContent = groupImportContent + "\n\n"
34 }
35
36 groupFileContent = fmt.Sprintf(`%s<div className="group" data-group="%s">%s`+"\n"+`</div>`, groupImportContent, groupID, groupContent)
37 }
38
39 err := os.MkdirAll(filepath.Dir(group.File), os.ModePerm)
40 if err != nil {
41 panic(err)
42 }
43
44 err = os.WriteFile(group.File, []byte(groupFileContent), os.ModePerm)
45 if err != nil {
46 panic(err)
47 }
48 }
49}

Callers 2

mainFunction · 0.92
createSectionsFunction · 0.85

Calls 1

GetPartialImportFunction · 0.85

Tested by

no test coverage detected