mirror of
https://github.com/neilotoole/sq.git
synced 2024-12-19 14:11:45 +03:00
81f631e135
* Renamed source.Type to source.DriverType for clarity * More renaming wrt source.DriverType * Renamed output.Formatting to output.Printing
26 lines
521 B
Go
26 lines
521 B
Go
package tablew
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
|
|
"github.com/neilotoole/sq/cli/output"
|
|
)
|
|
|
|
// errorWriter implements output.ErrorWriter.
|
|
type errorWriter struct {
|
|
w io.Writer
|
|
pr *output.Printing
|
|
}
|
|
|
|
// NewErrorWriter returns an output.ErrorWriter that
|
|
// outputs in text format.
|
|
func NewErrorWriter(w io.Writer, pr *output.Printing) output.ErrorWriter {
|
|
return &errorWriter{w: w, pr: pr}
|
|
}
|
|
|
|
// Error implements output.ErrorWriter.
|
|
func (w *errorWriter) Error(err error) {
|
|
fmt.Fprintln(w.w, w.pr.Error.Sprintf("sq: %v", err))
|
|
}
|