MCPcopy Create free account
hub / github.com/driangle/taskmd / columnWidths

Method columnWidths

apps/cli/internal/cli/tablewriter.go:63–83  ·  view source on GitHub ↗

columnWidths returns the max visible width for each column.

()

Source from the content-addressed store, hash-verified

61
62// columnWidths returns the max visible width for each column.
63func (tw *TableWriter) columnWidths() []int {
64 var maxCols int
65 for _, row := range tw.rows {
66 if !row.isSep && len(row.plain) > maxCols {
67 maxCols = len(row.plain)
68 }
69 }
70
71 widths := make([]int, maxCols)
72 for _, row := range tw.rows {
73 if row.isSep {
74 continue
75 }
76 for i, cell := range row.plain {
77 if len(cell) > widths[i] {
78 widths[i] = len(cell)
79 }
80 }
81 }
82 return widths
83}
84
85func (tw *TableWriter) writeSeparator(w io.Writer, widths []int) {
86 cells := make([]string, len(widths))

Callers 1

FlushMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected