Skip to content

Commit a5be90f

Browse files
committed
print final summary with fmt instead of table
1 parent 3723381 commit a5be90f

File tree

2 files changed

+28
-16
lines changed

2 files changed

+28
-16
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.3.2
1+
1.4.0

pkg/reporter/reporter.go

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
package reporter
22

3-
import (
4-
"os"
5-
6-
"github.com/olekukonko/tablewriter"
7-
)
3+
import "fmt"
84

95
const (
106
SUCCESS = "SUCCESS"
@@ -18,24 +14,40 @@ type (
1814
}
1915

2016
reporter struct {
21-
table *tablewriter.Table
17+
data []struct {
18+
name string
19+
status string
20+
message string
21+
}
2222
}
2323
)
2424

2525
func NewReporter() Reporter {
26-
table := tablewriter.NewWriter(os.Stdout)
27-
table.SetHeader([]string{"Context Name", "Status", "Message"})
28-
table.SetAutoMergeCells(true)
29-
table.SetRowLine(true)
30-
return &reporter{
31-
table: table,
32-
}
26+
return &reporter{}
3327
}
3428

3529
func (r *reporter) AddToReport(contextName string, status string, message string) {
36-
r.table.Append([]string{contextName, status, message})
30+
r.data = append(r.data, struct {
31+
name string
32+
status string
33+
message string
34+
}{
35+
name: contextName,
36+
status: status,
37+
message: message,
38+
})
3739
}
3840

3941
func (r *reporter) Print() {
40-
r.table.Render()
42+
for _, d := range r.data {
43+
if d.status == SUCCESS {
44+
fmt.Printf("Context %s created\n", d.name)
45+
continue
46+
}
47+
48+
if d.status == FAILED {
49+
fmt.Printf("Failed to create context %s.%s\n", d.name, d.message)
50+
continue
51+
}
52+
}
4153
}

0 commit comments

Comments
 (0)