mirror of
https://github.com/go-task/task.git
synced 2025-01-12 04:34:11 +02:00
a407b0a8eb
Ref #104
27 lines
406 B
Go
27 lines
406 B
Go
package output
|
|
|
|
import (
|
|
"bytes"
|
|
"io"
|
|
)
|
|
|
|
type Group struct{}
|
|
|
|
func (Group) WrapWriter(w io.Writer, _ string) io.WriteCloser {
|
|
return &groupWriter{writer: w}
|
|
}
|
|
|
|
type groupWriter struct {
|
|
writer io.Writer
|
|
buff bytes.Buffer
|
|
}
|
|
|
|
func (gw *groupWriter) Write(p []byte) (int, error) {
|
|
return gw.buff.Write(p)
|
|
}
|
|
|
|
func (gw *groupWriter) Close() error {
|
|
_, err := io.Copy(gw.writer, &gw.buff)
|
|
return err
|
|
}
|