Documentation
ΒΆ
Overview ΒΆ
Package table provides a utility for rendering ASCII tables with box-drawing characters
Index ΒΆ
- Constants
- type Table
- func (t *Table) AddDescription(rowIndex int, description string)
- func (t *Table) AddDescriptionWithTitle(rowIndex int, title string, description string)
- func (t *Table) AddHighlightedHeader(index int)
- func (t *Table) AddRow(row []string)
- func (t *Table) ClearHighlightedHeaders()
- func (t *Table) EnableRowCount(enabled bool) *Table
- func (t *Table) Render() string
- func (t *Table) SetAlignment(columnIndex int, alignment string)
- func (t *Table) SetBorderless(on bool)
- func (t *Table) SetConsoleWidth(width int)
- func (t *Table) SetDimBorder(enabled bool)
- func (t *Table) SetFillWidth(enabled bool)
- func (t *Table) SetHeaderHighlighting(enabled bool)
- func (t *Table) SetHighlightedHeaders(indices []int)
- func (t *Table) SetMaxWidth(columnIndex int, maxWidth int)
- type TableGroup
Constants ΒΆ
const ( // ANSI codes //DimStyleStart = "\x1b[38;5;242m" // faint + darker gray for very subdued borders DimStyleStart = "\x1b[2m\x1b[38;5;240m" DimStyleEnd = "\x1b[0m" BoldStyleStart = "\x1b[1m" // Bold style for highlighting BoldStyleEnd = "\x1b[0m" // Box drawing characters TopLeft = "β" TopRight = "β" BottomLeft = "β" BottomRight = "β" HLine = "β" VLine = "β" LeftT = "β" RightT = "β€" TopT = "β¬" BottomT = "β΄" Cross = "βΌ" )
Variables ΒΆ
This section is empty.
Functions ΒΆ
This section is empty.
Types ΒΆ
type Table ΒΆ
type Table struct {
Headers []string
Rows [][]string
Descriptions map[int][]string // row index -> description
DescriptionTitles map[int][]string // row index -> title (optional)
// contains filtered or unexported fields
}
Table represents a table with borders and alignment control
func PlenumDevTable ΒΆ
func (*Table) AddDescription ΒΆ
AddDescription adds a description for a specific row
func (*Table) AddDescriptionWithTitle ΒΆ
AddDescriptionWithTitle adds a description with a title for a specific row
func (*Table) AddHighlightedHeader ΒΆ
AddHighlightedHeader adds a header to the highlighted list
func (*Table) ClearHighlightedHeaders ΒΆ
func (t *Table) ClearHighlightedHeaders()
ClearHighlightedHeaders removes all header highlights
func (*Table) EnableRowCount ΒΆ
func (*Table) SetAlignment ΒΆ
SetAlignment sets the alignment for a specific column
func (*Table) SetBorderless ΒΆ
SetBorderless enables/disables drawing of any boxβdrawing characters.
func (*Table) SetConsoleWidth ΒΆ
SetConsoleWidth sets the maximum width for the table
func (*Table) SetDimBorder ΒΆ
func (*Table) SetFillWidth ΒΆ
SetFillWidth sets whether the table should expand to fill the console width
func (*Table) SetHeaderHighlighting ΒΆ
SetHeaderHighlighting enables/disables header highlighting
func (*Table) SetHighlightedHeaders ΒΆ
SetHighlightedHeaders sets which headers should be highlighted
func (*Table) SetMaxWidth ΒΆ
SetMaxWidth sets the maximum width for a specific column
type TableGroup ΒΆ
type TableGroup struct {
// contains filtered or unexported fields
}
TableGroup manages multiple tables with consistent column widths
func NewGroup ΒΆ
func NewGroup() *TableGroup
NewGroup creates a new TableGroup for managing multiple tables
func (*TableGroup) GetTables ΒΆ
func (g *TableGroup) GetTables() []*Table
GetTables returns the tables in the group (public method for testing)
func (*TableGroup) SyncColumnWidths ΒΆ
func (g *TableGroup) SyncColumnWidths()
SyncColumnWidths ensures all tables in the group have consistent column widths