MCPcopy
hub / github.com/go-task/task / BuildFor

Function BuildFor

internal/output/output.go:19–40  ·  view source on GitHub ↗

Build the Output for the requested ast.Output.

(o *ast.Output, logger *logger.Logger)

Source from the content-addressed store, hash-verified

17
18// Build the Output for the requested ast.Output.
19func 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
42func checkOutputGroupUnset(o *ast.Output) error {
43 if o.Group.IsSet() {

Callers 1

setupOutputMethod · 0.92

Calls 2

checkOutputGroupUnsetFunction · 0.85
NewPrefixedFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…