(stdOut, _ io.Writer, _ string, cache *templater.Cache)
| 13 | } |
| 14 | |
| 15 | func (g Group) WrapWriter(stdOut, _ io.Writer, _ string, cache *templater.Cache) (io.Writer, io.Writer, CloseFunc) { |
| 16 | gw := &groupWriter{writer: stdOut} |
| 17 | if g.Begin != "" { |
| 18 | gw.begin = templater.Replace(g.Begin, cache) + "\n" |
| 19 | } |
| 20 | if g.End != "" { |
| 21 | gw.end = templater.Replace(g.End, cache) + "\n" |
| 22 | } |
| 23 | return gw, gw, func(err error) error { |
| 24 | if g.ErrorOnly && err == nil { |
| 25 | return nil |
| 26 | } |
| 27 | return gw.close() |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | type groupWriter struct { |
| 32 | writer io.Writer |