mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-25 22:00:58 +02:00
deps: Upgrade github.com/olekukonko/tablewriter v0.0.5 => v1.0.7
This commit is contained in:
@@ -19,6 +19,8 @@ import (
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/olekukonko/tablewriter"
|
||||
"github.com/olekukonko/tablewriter/renderer"
|
||||
"github.com/olekukonko/tablewriter/tw"
|
||||
)
|
||||
|
||||
// ProcessingStats represents statistics about a site build.
|
||||
@@ -66,23 +68,6 @@ func (s *ProcessingStats) Add(counter *uint64, amount int) {
|
||||
atomic.AddUint64(counter, uint64(amount))
|
||||
}
|
||||
|
||||
// Table writes a table-formatted representation of the stats in a
|
||||
// ProcessingStats instance to w.
|
||||
func (s *ProcessingStats) Table(w io.Writer) {
|
||||
titleVals := s.toVals()
|
||||
data := make([][]string, len(titleVals))
|
||||
for i, tv := range titleVals {
|
||||
data[i] = []string{tv.name, strconv.Itoa(int(tv.val))}
|
||||
}
|
||||
|
||||
table := tablewriter.NewWriter(w)
|
||||
|
||||
table.AppendBulk(data)
|
||||
table.SetHeader([]string{"", s.Name})
|
||||
table.SetBorder(false)
|
||||
table.Render()
|
||||
}
|
||||
|
||||
// ProcessingStatsTable writes a table-formatted representation of stats to w.
|
||||
func ProcessingStatsTable(w io.Writer, stats ...*ProcessingStats) {
|
||||
names := make([]string, len(stats)+1)
|
||||
@@ -106,13 +91,26 @@ func ProcessingStatsTable(w io.Writer, stats ...*ProcessingStats) {
|
||||
data[j] = append(data[j], strconv.Itoa(int(tv.val)))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
table := tablewriter.NewWriter(w)
|
||||
table := tablewriter.NewTable(
|
||||
w,
|
||||
tablewriter.WithRenderer(renderer.NewBlueprint(tw.Rendition{
|
||||
Borders: tw.BorderNone,
|
||||
Symbols: tw.NewSymbols(tw.StyleLight),
|
||||
Settings: tw.Settings{
|
||||
Separators: tw.Separators{BetweenRows: tw.Off},
|
||||
Lines: tw.Lines{ShowFooterLine: tw.On},
|
||||
},
|
||||
})),
|
||||
tablewriter.WithConfig(
|
||||
tablewriter.Config{
|
||||
MaxWidth: 70,
|
||||
Row: tw.CellConfig{Alignment: tw.CellAlignment{Global: tw.AlignRight, PerColumn: []tw.Align{tw.AlignLeft}}},
|
||||
}),
|
||||
)
|
||||
|
||||
table.AppendBulk(data)
|
||||
table.SetHeader(names)
|
||||
table.SetBorder(false)
|
||||
table.Bulk(data)
|
||||
table.Header(names)
|
||||
table.Render()
|
||||
}
|
||||
|
Reference in New Issue
Block a user