MCPcopy Create free account
hub / github.com/hashicorp/vault / tableOutput

Function tableOutput

command/base_helpers.go:104–131  ·  view source on GitHub ↗

tableOutput prints the list of items as columns, where the first row is the list of headers.

(list []string, c *columnize.Config)

Source from the content-addressed store, hash-verified

102// tableOutput prints the list of items as columns, where the first row is
103// the list of headers.
104func tableOutput(list []string, c *columnize.Config) string {
105 if len(list) == 0 {
106 return ""
107 }
108
109 delim := "|"
110 if c != nil && c.Delim != "" {
111 delim = c.Delim
112 }
113
114 underline := ""
115 headers := strings.Split(list[0], delim)
116 for i, h := range headers {
117 h = strings.TrimSpace(h)
118 u := strings.Repeat("-", len(h))
119
120 underline = underline + u
121 if i != len(headers)-1 {
122 underline = underline + delim
123 }
124 }
125
126 list = append(list, "")
127 copy(list[2:], list[1:])
128 list[1] = underline
129
130 return columnOutput(list, c)
131}
132
133// parseArgsData parses the given args in the format key=value into a map of
134// the provided arguments. The given reader can also supply key=value pairs.

Callers 15

outputResultsTableMethod · 0.85
RunMethod · 0.85
RunMethod · 0.85
RunMethod · 0.85
RunMethod · 0.85
outputResultsTableMethod · 0.85
RunMethod · 0.85
RunMethod · 0.85
RunMethod · 0.85
RunMethod · 0.85
printStatusMethod · 0.85
RunMethod · 0.85

Calls 1

columnOutputFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…