package pprint import ( "fmt" "io" ) type CSVPrinter struct { writer io.Writer } // Headers specify the table headers func (p *CSVPrinter) Headers(headers ...string) { for _, header := range headers { fmt.Fprintf(p.writer, "%s,", header) } fmt.Fprintf(p.writer, "\n") } // Fields add another row func (p *CSVPrinter) Fields(fields ...interface{}) { for _, header := range fields { fmt.Fprintf(p.writer, "%v,", header) } fmt.Fprintf(p.writer, "\n") } // Flush implements the flush interface but for CVS printer is a noop func (p *CSVPrinter) Flush() { // noop }