mirror of
https://codeberg.org/scip/tablizer.git
synced 2025-12-17 12:31:06 +01:00
Fix excess spaces on normal ascii table output (#66)
This commit is contained in:
@@ -28,7 +28,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const DefaultSeparator string = `(\s\s+|\t)`
|
const DefaultSeparator string = `(\s\s+|\t)`
|
||||||
const Version string = "v1.5.3"
|
const Version string = "v1.5.4"
|
||||||
const MAXPARTS = 2
|
const MAXPARTS = 2
|
||||||
|
|
||||||
var DefaultConfigfile = os.Getenv("HOME") + "/.config/tablizer/config"
|
var DefaultConfigfile = os.Getenv("HOME") + "/.config/tablizer/config"
|
||||||
|
|||||||
@@ -204,8 +204,8 @@ func printASCIIData(writer io.Writer, conf cfg.Config, data *Tabdata) {
|
|||||||
Borders: tw.BorderNone,
|
Borders: tw.BorderNone,
|
||||||
Symbols: styleTSV,
|
Symbols: styleTSV,
|
||||||
Settings: tw.Settings{
|
Settings: tw.Settings{
|
||||||
Separators: tw.Separators{BetweenRows: tw.Off, BetweenColumns: tw.On},
|
Separators: tw.SeparatorsNone,
|
||||||
Lines: tw.Lines{ShowFooterLine: tw.Off, ShowHeaderLine: tw.Off},
|
Lines: tw.LinesNone,
|
||||||
},
|
},
|
||||||
})),
|
})),
|
||||||
tablewriter.WithConfig(tablewriter.Config{
|
tablewriter.WithConfig(tablewriter.Config{
|
||||||
@@ -213,23 +213,18 @@ func printASCIIData(writer io.Writer, conf cfg.Config, data *Tabdata) {
|
|||||||
Formatting: tw.CellFormatting{
|
Formatting: tw.CellFormatting{
|
||||||
AutoFormat: tw.Off,
|
AutoFormat: tw.Off,
|
||||||
},
|
},
|
||||||
Padding: tw.CellPadding{
|
Padding: tw.CellPadding{Global: tw.Padding{Left: "", Right: " "}},
|
||||||
Global: tw.Padding{Left: "", Right: ""},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
Row: tw.CellConfig{
|
Row: tw.CellConfig{
|
||||||
Formatting: tw.CellFormatting{
|
Formatting: tw.CellFormatting{
|
||||||
AutoWrap: tw.WrapNone,
|
AutoWrap: tw.WrapNone,
|
||||||
Alignment: tw.AlignLeft,
|
Alignment: tw.AlignLeft,
|
||||||
},
|
},
|
||||||
Padding: tw.CellPadding{
|
Padding: tw.CellPadding{Global: tw.Padding{Right: " "}},
|
||||||
Global: tw.Padding{Left: "", Right: ""},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
Debug: true,
|
Debug: true,
|
||||||
}),
|
}),
|
||||||
tablewriter.WithPadding(tw.PaddingNone),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if !conf.NoHeaders {
|
if !conf.NoHeaders {
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ alpha 2013-Feb-03
|
|||||||
ceta 06/Jan/2008 15:04:05 -0700`,
|
ceta 06/Jan/2008 15:04:05 -0700`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "usecolumns",
|
name: "usecolumns2",
|
||||||
usecol: []int{2},
|
usecol: []int{2},
|
||||||
numberize: true,
|
numberize: true,
|
||||||
usecolstr: "2",
|
usecolstr: "2",
|
||||||
@@ -227,7 +227,7 @@ DURATION(2)
|
|||||||
33d12h`,
|
33d12h`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "usecolumns",
|
name: "usecolumns3",
|
||||||
usecol: []int{3},
|
usecol: []int{3},
|
||||||
numberize: true,
|
numberize: true,
|
||||||
usecolstr: "3",
|
usecolstr: "3",
|
||||||
@@ -238,7 +238,7 @@ COUNT(3)
|
|||||||
9`,
|
9`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "usecolumns",
|
name: "usecolumns4",
|
||||||
column: 0,
|
column: 0,
|
||||||
usecol: []int{1, 3},
|
usecol: []int{1, 3},
|
||||||
numberize: true,
|
numberize: true,
|
||||||
@@ -304,7 +304,8 @@ func TestPrinter(t *testing.T) {
|
|||||||
|
|
||||||
if got != exp {
|
if got != exp {
|
||||||
t.Errorf("not rendered correctly:\n+++ got:\n%s\n+++ want:\n%s",
|
t.Errorf("not rendered correctly:\n+++ got:\n%s\n+++ want:\n%s",
|
||||||
got, exp)
|
strings.ReplaceAll(got, " ", "_"),
|
||||||
|
strings.ReplaceAll(exp, " ", "_"))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user