Documentation
ยถ
Index ยถ
- Variables
- type Alignment
- type Borders
- type Dividers
- type Style
- type Table
- func (t *Table) AddFooters(footers ...string)
- func (t *Table) AddHeaders(headers ...string)
- func (t *Table) AddRow(cols ...string)
- func (t *Table) AddRows(rows ...[]string)
- func (t *Table) LoadCSV(r io.Reader, hasHeaders bool) error
- func (t *Table) Render()
- func (t *Table) SetAlignment(columns ...Alignment)
- func (t *Table) SetAutoMerge(enabled bool)
- func (t *Table) SetAutoMergeHeaders(enabled bool)
- func (t *Table) SetAvailableWidth(w int)
- func (t *Table) SetBorderBottom(enabled bool)
- func (t *Table) SetBorderLeft(enabled bool)
- func (t *Table) SetBorderRight(enabled bool)
- func (t *Table) SetBorderTop(enabled bool)
- func (t *Table) SetBorders(enabled bool)
- func (t *Table) SetColSpans(rowIndex int, colSpans ...int)
- func (t *Table) SetColumnMaxWidth(maxColumnWidth int)
- func (t *Table) SetDividers(d Dividers)
- func (t *Table) SetFillWidth(enabled bool)
- func (t *Table) SetFooterAlignment(columns ...Alignment)
- func (t *Table) SetFooterColSpans(rowIndex int, colSpans ...int)
- func (t *Table) SetFooters(footers ...string)
- func (t *Table) SetHeaderAlignment(columns ...Alignment)
- func (t *Table) SetHeaderColSpans(rowIndex int, colSpans ...int)
- func (t *Table) SetHeaderStyle(s Style)
- func (t *Table) SetHeaderVerticalAlignment(a Alignment)
- func (t *Table) SetHeaders(headers ...string)
- func (t *Table) SetLineStyle(s Style)
- func (t *Table) SetPadding(padding int)
- func (t *Table) SetRowLines(enabled bool)
Constants ยถ
This section is empty.
Variables ยถ
var ASCIIDividers = Dividers{
ALL: "+",
NES: "+",
NSW: "+",
NEW: "+",
ESW: "+",
NE: "+",
NW: "+",
SW: "+",
ES: "+",
EW: "-",
NS: "|",
}
var MarkdownDividers = Dividers{
ALL: "|",
NES: "|",
NSW: "|",
NE: "|",
NW: "|",
SW: "|",
ES: "|",
EW: "-",
NS: "|",
}
var NoDividers = Dividers{}
var StarDividers = Dividers{
ALL: "*",
NES: "*",
NSW: "*",
NEW: "*",
ESW: "*",
NE: "*",
NW: "*",
SW: "*",
ES: "*",
EW: "*",
NS: "*",
}
var UnicodeDividers = Dividers{
ALL: "โผ",
NES: "โ",
NSW: "โค",
NEW: "โด",
ESW: "โฌ",
NE: "โ",
NW: "โ",
SW: "โ",
ES: "โ",
EW: "โ",
NS: "โ",
}
var UnicodeRoundedDividers = Dividers{
ALL: "โผ",
NES: "โ",
NSW: "โค",
NEW: "โด",
ESW: "โฌ",
NE: "โฐ",
NW: "โฏ",
SW: "โฎ",
ES: "โญ",
EW: "โ",
NS: "โ",
}
Functions ยถ
This section is empty.
Types ยถ
type Style ยถ
type Style int
const ( StyleNormal Style = 0 StyleBold Style = 1 StyleDim Style = 2 StyleItalic Style = 3 StyleUnderline Style = 4 StyleBlack Style = 30 StyleRed Style = 31 StyleGreen Style = 32 StyleYellow Style = 33 StyleBlue Style = 34 StyleMagenta Style = 35 StyleCyan Style = 36 StyleWhite Style = 37 StyleBrightBlack Style = 90 StyleBrightRed Style = 91 StyleBrightGreen Style = 92 StyleBrightYellow Style = 93 StyleBrightBlue Style = 94 StyleBrightMagenta Style = 95 StyleBrightCyan Style = 96 StyleBrightWhite Style = 97 )
type Table ยถ
type Table struct {
// contains filtered or unexported fields
}
Table holds information required to render a table to the terminal
func (*Table) AddFooters ยถ
AddFooters adds a row of footers to the table.
func (*Table) AddHeaders ยถ
AddHeaders adds a row of headers to the table.
func (*Table) AddRows ยถ
AddRows adds multiple rows to the table. Each argument is a row, i.e. a slice of column values.
func (*Table) LoadCSV ยถ
LoadCSV loads CSV data from a reader and adds it to the table. Existing rows/headers/footers are retained.
func (*Table) SetAlignment ยถ
SetAlignment sets the alignment of each column. Should be specified for each column in the supplied data. Default alignment for columns is AlignLeft
func (*Table) SetAutoMerge ยถ
SetAutoMerge sets whether to merge cells vertically if their content is the same and non-empty
func (*Table) SetAutoMergeHeaders ยถ
SetAutoMergeHeaders sets whether to merge header cells vertically if their content is the same and non-empty
func (*Table) SetAvailableWidth ยถ
SetAvailableWidth sets the available width for the table (defaults to terminal width when stdout is used)
func (*Table) SetBorderBottom ยถ
SetBorderBottom enables/disables the border line on the bottom edge of the table
func (*Table) SetBorderLeft ยถ
SetBorderLeft enables/disables the border line on the left edge of the table
func (*Table) SetBorderRight ยถ
SetBorderRight enables/disables the border line on the right edge of the table
func (*Table) SetBorderTop ยถ
SetBorderTop enables/disables the border line on the top edge of the table
func (*Table) SetBorders ยถ
SetBorders enables/disables the border around the table
func (*Table) SetColSpans ยถ
SetColSpans sets a column span for each column in the given row.
func (*Table) SetColumnMaxWidth ยถ
SetColumnMaxWidth sets the max column width
func (*Table) SetDividers ยถ
SetDividers allows customisation of the characters used to draw the table. There are several built-in options, such as UnicodeRoundedDividers. Specifying divider values containing more than 1 rune will result in undefined behaviour.
func (*Table) SetFillWidth ยถ
SetFillWidth sets whether to fill the entire available width
func (*Table) SetFooterAlignment ยถ
SetFooterAlignment sets the alignment of each footer. Should be specified for each footer in the supplied data. Default alignment for footers is AlignCenter
func (*Table) SetFooterColSpans ยถ
SetFooterColSpans sets a column span for each column in the given footer row.
func (*Table) SetFooters ยถ
SetFooters set the footers used for the table.
func (*Table) SetHeaderAlignment ยถ
SetHeaderAlignment sets the alignment of each header. Should be specified for each header in the supplied data. Default alignment for headers is AlignCenter
func (*Table) SetHeaderColSpans ยถ
SetHeaderColSpans sets a column span for each column in the given header row.
func (*Table) SetHeaderStyle ยถ
SetHeaderStyle set the style used for headers
func (*Table) SetHeaderVerticalAlignment ยถ
func (*Table) SetHeaders ยถ
SetHeaders set the headers used for the table.
func (*Table) SetLineStyle ยถ
SetLineStyle sets the ANSI style of the lines used when drawing the table. e.g. StyleYellow
func (*Table) SetPadding ยถ
SetPadding sets the minimum number of spaces which must surround each column value (horizontally). For example, a padding of 3 would result in a column value such as " hello world " (3 spaces either side)
func (*Table) SetRowLines ยถ
SetRowLines sets whether to render horizontal lines between rows
Directories
ยถ
| Path | Synopsis |
|---|---|
|
_examples
|
|
|
01-basic
command
|
|
|
02-no-row-lines
command
|
|
|
03-no-borders
command
|
|
|
04-no-borders-or-row-lines
command
|
|
|
05-specific-borders
command
|
|
|
06-footers
command
|
|
|
07-padding
command
|
|
|
08-alignment
command
|
|
|
09-rounded-corners
command
|
|
|
10-custom-dividers
command
|
|
|
11-auto-merge-cells
command
|
|
|
12-load-data-from-csv
command
|
|
|
13-markdown-format
command
|
|
|
14-header-colspans
command
|
|
|
15-only-wrap-when-needed
command
|
|
|
95-double-width-unicode
command
|
|
|
99-ansi
command
|
|
|
cmd
|
|
|
examples
command
|