MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / printTable

Function printTable

internal/cli/cli_helpers.go:277–294  ·  view source on GitHub ↗

printTable writes aligned tabular output to stdout.

(headers []string, rows [][]string)

Source from the content-addressed store, hash-verified

275
276// printTable writes aligned tabular output to stdout.
277func printTable(headers []string, rows [][]string) {
278 w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
279
280 _, _ = fmt.Fprintln(w, strings.Join(headers, "\t"))
281
282 seps := make([]string, len(headers))
283 for i, h := range headers {
284 seps[i] = strings.Repeat("-", len(h))
285 }
286
287 _, _ = fmt.Fprintln(w, strings.Join(seps, "\t"))
288
289 for _, row := range rows {
290 _, _ = fmt.Fprintln(w, strings.Join(row, "\t"))
291 }
292
293 _ = w.Flush()
294}
295
296// formatBytes formats a byte count as a human-readable string (e.g. 1.5 GiB).
297func formatBytes(b int64) string {

Callers 15

runStorageListFunction · 0.85
runStorageShowFunction · 0.85
runStorageContentListFunction · 0.85
TestPrintTableFunction · 0.85
runNodesListFunction · 0.85
runNodesShowFunction · 0.85
runTasksListFunction · 0.85
printInstallResultFunction · 0.85
runGuestsListFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestPrintTableFunction · 0.68