MCPcopy
hub / github.com/cilium/cilium / namespaceTableOutput

Function namespaceTableOutput

hubble/cmd/list/namespaces.go:80–98  ·  view source on GitHub ↗
(buf io.Writer, namespaces []*observerpb.Namespace)

Source from the content-addressed store, hash-verified

78}
79
80func namespaceTableOutput(buf io.Writer, namespaces []*observerpb.Namespace) error {
81 tw := tabwriter.NewWriter(buf, 2, 0, 3, ' ', 0)
82 // header
83 fmt.Fprint(tw, "NAMESPACE")
84 if listOpts.output == "wide" {
85 fmt.Fprint(tw, "\tCLUSTER")
86 }
87 fmt.Fprintln(tw)
88
89 // contents
90 for _, ns := range namespaces {
91 fmt.Fprint(tw, ns.GetNamespace())
92 if listOpts.output == "wide" && ns.GetCluster() != "" {
93 fmt.Fprint(tw, "\t", ns.GetCluster())
94 }
95 fmt.Fprintln(tw)
96 }
97 return tw.Flush()
98}

Callers 2

TestNamespaceOutputsFunction · 0.85
runListNamespacesFunction · 0.85

Calls 4

NewWriterMethod · 0.80
GetNamespaceMethod · 0.65
GetClusterMethod · 0.65
FlushMethod · 0.45

Tested by 1

TestNamespaceOutputsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…