Build the Output for the requested ast.Output.
(o *ast.Output, logger *logger.Logger)
| 17 | |
| 18 | // Build the Output for the requested ast.Output. |
| 19 | func BuildFor(o *ast.Output, logger *logger.Logger) (Output, error) { |
| 20 | switch o.Name { |
| 21 | case "interleaved", "": |
| 22 | if err := checkOutputGroupUnset(o); err != nil { |
| 23 | return nil, err |
| 24 | } |
| 25 | return Interleaved{}, nil |
| 26 | case "group": |
| 27 | return Group{ |
| 28 | Begin: o.Group.Begin, |
| 29 | End: o.Group.End, |
| 30 | ErrorOnly: o.Group.ErrorOnly, |
| 31 | }, nil |
| 32 | case "prefixed": |
| 33 | if err := checkOutputGroupUnset(o); err != nil { |
| 34 | return nil, err |
| 35 | } |
| 36 | return NewPrefixed(logger), nil |
| 37 | default: |
| 38 | return nil, fmt.Errorf(`task: output style %q not recognized`, o.Name) |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | func checkOutputGroupUnset(o *ast.Output) error { |
| 43 | if o.Group.IsSet() { |
no test coverage detected
searching dependent graphs…