-
Notifications
You must be signed in to change notification settings - Fork 0
/
dump_debug.go
49 lines (44 loc) · 1.36 KB
/
dump_debug.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// +build debug
package columns
import (
"fmt"
"strings"
)
func (cw *ColumnsWriter) dump() {
var a, b, c string
for i, col := range cw.columns {
a += fmt.Sprint(cw.spacers[i], strings.Repeat("O", col.outerSize()))
b += fmt.Sprint(cw.spacers[i], strings.Repeat("+", col.sizePrefix), strings.Repeat("I", col.innerSize()), strings.Repeat("-", col.sizeSuffix))
// //fmt.Printf("> Column %d: size:%d sizeI:%d sizeF:%d\n", i, c.size, c.sizeI, c.sizeF)
if col.sizeI > 0 {
var fillSize int
var fillAfter string
if col.sizeF > 0 {
fillSize--
}
fillSize += col.outerSize() - col.sizeI - col.sizeF - col.sizePrefix - col.sizeSuffix
fillBefore := strings.Repeat("_", fillSize)
if col.align == AlignLeft { // not working on AlignMiddle
fillAfter = fillBefore
fillBefore = ""
}
c += fmt.Sprint(cw.spacers[i],
strings.Repeat("+", col.sizePrefix),
fillBefore,
strings.Repeat("N", col.sizeI),
strings.Repeat(".", col.sizeDot),
strings.Repeat("D", col.sizeF),
fillAfter,
strings.Repeat("-", col.sizeSuffix))
} else {
c += fmt.Sprint(cw.spacers[i],
strings.Repeat("+", col.sizePrefix),
strings.Repeat("T", col.sizeValue),
strings.Repeat("-", col.sizeSuffix))
}
}
a += cw.spacers[len(cw.columns)]
b += cw.spacers[len(cw.columns)]
c += cw.spacers[len(cw.columns)]
fmt.Print(a, "\n", b, "\n", c, "\n")
}