(node *yaml.Node)
| 20 | } |
| 21 | |
| 22 | func (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. |
| 54 | type OutputGroup struct { |
nothing calls this directly
no test coverage detected