MCPcopy Index your code
hub / github.com/cloudfoundry/cli / NewTable

Function NewTable

cf/terminal/table.go:32–49  ·  view source on GitHub ↗

NewTable is the constructor function creating a new printable table from a list of headers. The table is also connected to a UI, which is where it will print itself to on demand.

(headers []string)

Source from the content-addressed store, hash-verified

30// from a list of headers. The table is also connected to a UI, which
31// is where it will print itself to on demand.
32func NewTable(headers []string) *Table {
33 pt := &Table{
34 headers: headers,
35 columnWidth: make([]int, len(headers)),
36 colSpacing: " ",
37 transformer: make([]Transformer, len(headers)),
38 }
39 // Standard colorization, column 0 is auto-highlighted as some
40 // name. Everything else has no transformation (== identity
41 // transform)
42 for i := range pt.transformer {
43 pt.transformer[i] = nop
44 }
45 if 0 < len(headers) {
46 pt.transformer[0] = TableContentHeaderColor
47 }
48 return pt
49}
50
51// NoHeaders disables the printing of the header row for the specified
52// table.

Callers 2

table_test.goFile · 0.85
TableMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected