(writer io.Writer)
| 49 | } |
| 50 | |
| 51 | func NewTable(writer io.Writer) Table { |
| 52 | width := defaultWidth |
| 53 | if term.IsTerminal(int(os.Stdin.Fd())) { |
| 54 | width, _, _ = term.GetSize(int(os.Stdout.Fd())) |
| 55 | if width < 1 { |
| 56 | width = defaultWidth |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | return &table{ |
| 61 | out: writer, |
| 62 | maxWidth: width, |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | func (t *table) AddRow(s ...string) { |
| 67 | t.rows = append(t.rows, s) |
no outgoing calls
no test coverage detected