mirror of
https://github.com/neilotoole/sq.git
synced 2024-12-25 09:16:59 +03:00
26 lines
519 B
Go
26 lines
519 B
Go
package tablew
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
|
|
"github.com/neilotoole/sq/cli/output"
|
|
)
|
|
|
|
// errorWriter implements output.ErrorWriter.
|
|
type errorWriter struct {
|
|
w io.Writer
|
|
f *output.Formatting
|
|
}
|
|
|
|
// NewErrorWriter returns an output.ErrorWriter that
|
|
// outputs in text format.
|
|
func NewErrorWriter(w io.Writer, f *output.Formatting) output.ErrorWriter {
|
|
return &errorWriter{w: w, f: f}
|
|
}
|
|
|
|
// Error implements output.ErrorWriter.
|
|
func (w *errorWriter) Error(err error) {
|
|
fmt.Fprintln(w.w, w.f.Error.Sprintf("sq: %v", err))
|
|
}
|