Documentation ¶
Overview ¶
Package clitable provides a tool to view data as a table on the cmdline.
┌──┬──┐ │ │ │ ├──┼──┤ └──┴──┘
Index ¶
- Variables
- func CSVRowIterator(reader io.Reader, separator rune) <-chan Row
- func SimpleRowIterator(data [][]string) <-chan Row
- func StringWidth(s string) (width int, doubleWidthCount int)
- type CSVTable
- type Row
- type SimpleTable
- type Style
- type Table
- type TableInfo
- type TablePrinter
- func (tp *TablePrinter) Fprint(w io.Writer, t Table) error
- func (tp *TablePrinter) FprintCSVReader(w io.Writer, r io.Reader) error
- func (tp *TablePrinter) HasHeader(b bool) *TablePrinter
- func (tp *TablePrinter) Print(t Table) error
- func (tp *TablePrinter) Separator(c rune) *TablePrinter
- func (tp *TablePrinter) SetStyle(s Style) *TablePrinter
Constants ¶
This section is empty.
Variables ¶
Logger - Default *log.Logger variable. Set output to os.Stderr or override.
Functions ¶
func CSVRowIterator ¶
CSVRowIterator -
func StringWidth ¶
Types ¶
type CSVTable ¶
CSVTable - Implements the table interface from an io.Reader to CSV data.
func (CSVTable) RowIterator ¶
RowIterator - Implements the Table interface.
type SimpleTable ¶
type SimpleTable struct {
Data [][]string
}
SimpleTable - A basic structure that implements the Table interface.
func (SimpleTable) RowIterator ¶
func (t SimpleTable) RowIterator() <-chan Row
RowIterator - Implements the Table interface.
type Table ¶
type Table interface {
RowIterator() <-chan Row
}
Table - interface used to walk through a table one row at a time
type TableInfo ¶
type TableInfo struct { Columns int Rows int PerRowColumnWidths [][]int PerRowRows [][]int // Number of Lines in a Row due to multiline entries. ColumnWidths []int RowHeights []int }
TableInfo - Table information
func GetTableInfo ¶
GetTableInfo - Iterates over all the elements of the table to get number of Colums, Colum widths, etc.
type TablePrinter ¶
type TablePrinter struct {
// contains filtered or unexported fields
}
func NewTablePrinter ¶
func NewTablePrinter() *TablePrinter
func (*TablePrinter) FprintCSVReader ¶
func (*TablePrinter) HasHeader ¶
func (tp *TablePrinter) HasHeader(b bool) *TablePrinter
func (*TablePrinter) Print ¶
func (tp *TablePrinter) Print(t Table) error
func (*TablePrinter) Separator ¶ added in v0.3.0
func (tp *TablePrinter) Separator(c rune) *TablePrinter
func (*TablePrinter) SetStyle ¶
func (tp *TablePrinter) SetStyle(s Style) *TablePrinter
Click to show internal directories.
Click to hide internal directories.