New creates a TablePrinter from an IOStreams.
(ios *iostreams.IOStreams, headers headerOption)
| 45 | |
| 46 | // New creates a TablePrinter from an IOStreams. |
| 47 | func New(ios *iostreams.IOStreams, headers headerOption) *TablePrinter { |
| 48 | maxWidth := 80 |
| 49 | isTTY := ios.IsStdoutTTY() |
| 50 | if isTTY { |
| 51 | maxWidth = ios.TerminalWidth() |
| 52 | } |
| 53 | |
| 54 | return NewWithWriter(ios.Out, isTTY, maxWidth, ios.ColorScheme(), headers) |
| 55 | } |
| 56 | |
| 57 | // NewWithWriter creates a TablePrinter from a Writer, whether the output is a terminal, the terminal width, and more. |
| 58 | func NewWithWriter(w io.Writer, isTTY bool, maxWidth int, cs *iostreams.ColorScheme, headers headerOption) *TablePrinter { |