MCPcopy Index your code
hub / github.com/go-task/task / UnmarshalYAML

Method UnmarshalYAML

taskfile/ast/output.go:22–51  ·  view source on GitHub ↗
(node *yaml.Node)

Source from the content-addressed store, hash-verified

20}
21
22func (s *Output) UnmarshalYAML(node *yaml.Node) error {
23 switch node.Kind {
24
25 case yaml.ScalarNode:
26 var name string
27 if err := node.Decode(&name); err != nil {
28 return errors.NewTaskfileDecodeError(err, node)
29 }
30 s.Name = name
31 return nil
32
33 case yaml.MappingNode:
34 var tmp struct {
35 Group *OutputGroup
36 }
37 if err := node.Decode(&tmp); err != nil {
38 return errors.NewTaskfileDecodeError(err, node)
39 }
40 if tmp.Group == nil {
41 return errors.NewTaskfileDecodeError(nil, node).WithMessage(`output style must have the "group" key when in mapping form`)
42 }
43 *s = Output{
44 Name: "group",
45 Group: *tmp.Group,
46 }
47 return nil
48 }
49
50 return errors.NewTaskfileDecodeError(nil, node).WithTypeMessage("output")
51}
52
53// OutputGroup is the style options specific to the Group style.
54type OutputGroup struct {

Callers

nothing calls this directly

Implementers 3

Groupinternal/output/group.go
Interleavedinternal/output/interleaved.go
Prefixedinternal/output/prefixed.go

Calls 3

NewTaskfileDecodeErrorFunction · 0.92
WithMessageMethod · 0.80
WithTypeMessageMethod · 0.80

Tested by

no test coverage detected