MCPcopy Create free account
hub / github.com/belak/gitdir / ensureSampleConfigYaml

Function ensureSampleConfigYaml

config_ensure.go:21–38  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

19}
20
21func ensureSampleConfigYaml(data []byte) (*yaml.Node, bool, error) {
22 rootNode, targetNode, err := yaml.EnsureDocument(data)
23 if err != nil {
24 return nil, false, err
25 }
26
27 vals := [5]bool{
28 ensureSampleInvites(targetNode),
29 ensureSampleUsers(targetNode),
30 ensureSampleGroups(targetNode),
31 ensureSampleOrgs(targetNode),
32 ensureSampleOptions(targetNode),
33 }
34
35 // If we had to make any of the modifications, we need to specify the node
36 // was updated.
37 return rootNode, vals[0] || vals[1] || vals[2] || vals[3], nil
38}
39
40func ensureSampleInvites(targetNode *yaml.Node) bool {
41 _, modified := targetNode.EnsureKey(

Callers 1

ensureSampleConfigFunction · 0.85

Calls 6

EnsureDocumentFunction · 0.92
ensureSampleInvitesFunction · 0.85
ensureSampleUsersFunction · 0.85
ensureSampleGroupsFunction · 0.85
ensureSampleOrgsFunction · 0.85
ensureSampleOptionsFunction · 0.85

Tested by

no test coverage detected