Beispiel #1
0
func (e Environment) FindFromRoot(path []string) (yaml.Node, bool) {
	if len(e.Scope) == 0 {
		return nil, false
	}

	return yaml.FindR(true, yaml.NewNode(e.Scope[0], "scope"), path...)
}
Beispiel #2
0
func (e Environment) FindReference(path []string) (yaml.Node, bool) {
	root, found := resolveSymbol(path[0], e.Scope)
	if !found {
		return nil, false
	}

	return yaml.FindR(true, root, path[1:]...)
}
Beispiel #3
0
func newEntries(a []yaml.Node, b []yaml.Node, keyName string) []yaml.Node {
	if keyName == "" {
		keyName = "name"
	}
	old := yaml.KeyNameNode(yaml.NewNode(b, "some map"), keyName)
	added := []yaml.Node{}

	for _, val := range a {
		name, ok := yaml.FindStringR(true, val, keyName)
		if ok {
			_, found := yaml.FindR(true, old, name) // TODO
			if found {
				continue
			}
		}

		added = append(added, val)
	}

	return added
}