mirror of
https://codeberg.org/scip/tablizer.git
synced 2025-12-17 20:41:03 +01:00
optimize ascii tables, use custom style instead of tab inserters (#53)
* optimize ascii tables, use custom style instead of tab inserters
This commit is contained in:
@@ -196,13 +196,15 @@ Simple ASCII table without any borders etc, just like the input we expect
|
||||
func printASCIIData(writer io.Writer, conf cfg.Config, data *Tabdata) {
|
||||
tableString := &strings.Builder{}
|
||||
|
||||
styleTSV := tw.NewSymbolCustom("space").WithColumn("\t")
|
||||
|
||||
table := tablewriter.NewTable(tableString,
|
||||
tablewriter.WithRenderer(
|
||||
renderer.NewBlueprint(tw.Rendition{
|
||||
Borders: tw.BorderNone,
|
||||
Symbols: tw.NewSymbols(tw.StyleASCII),
|
||||
Symbols: styleTSV,
|
||||
Settings: tw.Settings{
|
||||
Separators: tw.Separators{BetweenRows: tw.Off, BetweenColumns: tw.Off},
|
||||
Separators: tw.Separators{BetweenRows: tw.Off, BetweenColumns: tw.On},
|
||||
Lines: tw.Lines{ShowFooterLine: tw.Off, ShowHeaderLine: tw.Off},
|
||||
},
|
||||
})),
|
||||
@@ -231,10 +233,10 @@ func printASCIIData(writer io.Writer, conf cfg.Config, data *Tabdata) {
|
||||
)
|
||||
|
||||
if !conf.NoHeaders {
|
||||
table.Header(data.TabHeaders())
|
||||
table.Header(data.headers)
|
||||
}
|
||||
|
||||
if err := table.Bulk(data.TabEntries()); err != nil {
|
||||
if err := table.Bulk(data.entries); err != nil {
|
||||
log.Fatalf("Failed to add data to table renderer: %s", err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user