appendProjectNode adds a new project entry to the document's projects list.
(doc *yaml.Node, id, name, path string)
| 274 | |
| 275 | // appendProjectNode adds a new project entry to the document's projects list. |
| 276 | func appendProjectNode(doc *yaml.Node, id, name, path string) { |
| 277 | mapping := doc.Content[0] |
| 278 | seq := findProjectsSequence(mapping) |
| 279 | if seq == nil { |
| 280 | // Create the "projects" key and sequence |
| 281 | keyNode := &yaml.Node{Kind: yaml.ScalarNode, Value: "projects", Tag: "!!str"} |
| 282 | seq = &yaml.Node{Kind: yaml.SequenceNode} |
| 283 | mapping.Content = append(mapping.Content, keyNode, seq) |
| 284 | } |
| 285 | seq.Content = append(seq.Content, buildProjectNode(id, name, path)) |
| 286 | } |
| 287 | |
| 288 | func buildProjectNode(id, name, path string) *yaml.Node { |
| 289 | return &yaml.Node{ |
no test coverage detected