-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathmain.go
48 lines (39 loc) · 977 Bytes
/
main.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
package main
import (
"github.com/alexeyco/simpletable"
)
var (
leftAligned = `Multiline content
left aligned`
centerAligned = `Multiline content
center aligned`
rightAligned = `Multiline content
right aligned`
singleLine = "Single line"
)
func main() {
table := simpletable.New()
table.Header = &simpletable.Header{
Cells: []*simpletable.Cell{
{Align: simpletable.AlignCenter, Text: "FOO"},
{Align: simpletable.AlignCenter, Text: "BAR"},
{Align: simpletable.AlignCenter, Text: "BAZ"},
},
}
table.Body = &simpletable.Body{
Cells: [][]*simpletable.Cell{
{
&simpletable.Cell{Align: simpletable.AlignLeft, Span: 2, Text: leftAligned},
&simpletable.Cell{Text: singleLine},
},
{
&simpletable.Cell{Align: simpletable.AlignCenter, Span: 3, Text: centerAligned},
},
{
&simpletable.Cell{Text: singleLine},
&simpletable.Cell{Align: simpletable.AlignRight, Span: 2, Text: rightAligned},
},
},
}
table.Println()
}