I don't know if I'm using SetHeaderColSpans correctly, but the layout is off:
Source (playground):
package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetHeaderColSpans(0, 2)
t.SetHeaderColSpans(1, 2)
t.AddHeaders("Header 1")
t.AddHeaders("Header 2")
t.AddHeaders("Header 3", "Header 4")
t.AddRow("Col 1", "Col 2")
t.AddFooters("Footer 1", "Footer 2")
t.Render()
}
Outputs:
┌─────────────────────┐
│ Header 1 │
├────────────────────────┤
│ Header 2 │
├──────────┬──────────┤
│ Header 3 │ Header 4 │
├──────────┼──────────┤
│ Col 1 │ Col 2 │
├──────────┼──────────┤
│ Footer 1 │ Footer 2 │
└──────────┴──────────┘
Expected:
┌─────────────────────┐
│ Header 1 │
├─────────────────────┤
│ Header 2 │
├──────────┬──────────┤
│ Header 3 │ Header 4 │
├──────────┼──────────┤
│ Col 1 │ Col 2 │
├──────────┼──────────┤
│ Footer 1 │ Footer 2 │
└──────────┴──────────┘
I don't know if I'm using
SetHeaderColSpanscorrectly, but the layout is off:Source (playground):
Outputs:
Expected: