Fix excess spaces on normal ascii table output (#66)

This commit is contained in:
T.v.Dein
2025-09-29 20:46:33 +02:00
committed by GitHub
parent 24b66b8a6b
commit 687f4b7bb2
3 changed files with 44 additions and 48 deletions

View File

@@ -28,7 +28,7 @@ import (
)
const DefaultSeparator string = `(\s\s+|\t)`
const Version string = "v1.5.3"
const Version string = "v1.5.4"
const MAXPARTS = 2
var DefaultConfigfile = os.Getenv("HOME") + "/.config/tablizer/config"

View File

@@ -204,8 +204,8 @@ func printASCIIData(writer io.Writer, conf cfg.Config, data *Tabdata) {
Borders: tw.BorderNone,
Symbols: styleTSV,
Settings: tw.Settings{
Separators: tw.Separators{BetweenRows: tw.Off, BetweenColumns: tw.On},
Lines: tw.Lines{ShowFooterLine: tw.Off, ShowHeaderLine: tw.Off},
Separators: tw.SeparatorsNone,
Lines: tw.LinesNone,
},
})),
tablewriter.WithConfig(tablewriter.Config{
@@ -213,23 +213,18 @@ func printASCIIData(writer io.Writer, conf cfg.Config, data *Tabdata) {
Formatting: tw.CellFormatting{
AutoFormat: tw.Off,
},
Padding: tw.CellPadding{
Global: tw.Padding{Left: "", Right: ""},
},
Padding: tw.CellPadding{Global: tw.Padding{Left: "", Right: " "}},
},
Row: tw.CellConfig{
Formatting: tw.CellFormatting{
AutoWrap: tw.WrapNone,
Alignment: tw.AlignLeft,
},
Padding: tw.CellPadding{
Global: tw.Padding{Left: "", Right: ""},
},
Padding: tw.CellPadding{Global: tw.Padding{Right: " "}},
},
Debug: true,
}),
tablewriter.WithPadding(tw.PaddingNone),
)
if !conf.NoHeaders {

View File

@@ -216,7 +216,7 @@ alpha 2013-Feb-03
ceta 06/Jan/2008 15:04:05 -0700`,
},
{
name: "usecolumns",
name: "usecolumns2",
usecol: []int{2},
numberize: true,
usecolstr: "2",
@@ -227,7 +227,7 @@ DURATION(2)
33d12h`,
},
{
name: "usecolumns",
name: "usecolumns3",
usecol: []int{3},
numberize: true,
usecolstr: "3",
@@ -238,7 +238,7 @@ COUNT(3)
9`,
},
{
name: "usecolumns",
name: "usecolumns4",
column: 0,
usecol: []int{1, 3},
numberize: true,
@@ -304,7 +304,8 @@ func TestPrinter(t *testing.T) {
if got != exp {
t.Errorf("not rendered correctly:\n+++ got:\n%s\n+++ want:\n%s",
got, exp)
strings.ReplaceAll(got, " ", "_"),
strings.ReplaceAll(exp, " ", "_"))
}
})
}