-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexamples_test.go
39 lines (34 loc) · 1.63 KB
/
examples_test.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
package table
import "os"
func ExampleFprint() {
Fprint(os.Stdout, "**Firstname**\t**Lastname**\t**Age**\nJill\tSmith\t50\nEve\tJackson\t45")
// Output:
// |**Firstname**|**Lastname**|**Age**|
// |-------------|------------|-------|
// | Jill | Smith | 50 |
// | Eve | Jackson | 45 |
}
func ExampleFprintf() {
Fprintf(os.Stdout,BoxStyle ,"**Firstname**\t**Lastname**\t**Age**\nJill\tSmith\t50\nEve\tJackson\t45")
// Output:
//┌─────────────┬────────────┬───────┐
//│**Firstname**│**Lastname**│**Age**│
//├─────────────┼────────────┼───────┤
//│ Jill │ Smith │ 50 │
//│ Eve │ Jackson │ 45 │
//└─────────────┴────────────┴───────┘
}
func ExamplePrint() {
Writer=os.Stdout
Style=RoundedDoubleInsideBoxStyle
ColumnMapper=MoveToLeftEdge(3)
SortColumn=1
Print("**Firstname**\t**Lastname**\t**Age**\nJill\tSmith\t50\nEve\tJackson\t45",RightJustified,Centred)
// Output:
//╭───────╥─────────────╥────────────╮
//│**Age**║**Firstname**║**Lastname**│
//╞═══════╬═════════════╬════════════╡
//│ 45║ Eve ║ Jackson │
//│ 50║ Jill ║ Smith │
//╰───────╨─────────────╨────────────╯
}