mirror of
https://codeberg.org/scip/tablizer.git
synced 2026-03-23 17:40:57 +01:00
fix-ascii-spacing (#51)
fix #50: remove excess spaces in normal ascii table output mode
This commit is contained in:
@@ -255,7 +255,15 @@ func printASCIIData(writer io.Writer, conf cfg.Config, data *Tabdata) {
|
||||
log.Fatalf("Failed to render table: %s", err)
|
||||
}
|
||||
|
||||
output(writer, conf, color.Sprint(colorizeData(conf, tableString.String())))
|
||||
// we need to trim our output here, because tablewriter appends
|
||||
// excess whitespace to our rows.
|
||||
cleanedString := &strings.Builder{}
|
||||
for _, row := range strings.Split(tableString.String(), "\n") {
|
||||
cleanedString.WriteString(strings.TrimSpace(row))
|
||||
cleanedString.WriteString("\n")
|
||||
}
|
||||
|
||||
output(writer, conf, color.Sprint(colorizeData(conf, cleanedString.String())))
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user