MCPcopy
hub / github.com/helm/helm / WriteTable

Method WriteTable

pkg/cmd/status.go:143–243  ·  view source on GitHub ↗
(out io.Writer)

Source from the content-addressed store, hash-verified

141}
142
143func (s statusPrinter) WriteTable(out io.Writer) error {
144 if s.release == nil {
145 return nil
146 }
147 rel := s.getV1Release()
148 _, _ = fmt.Fprintf(out, "NAME: %s\n", rel.Name)
149 if !rel.Info.LastDeployed.IsZero() {
150 _, _ = fmt.Fprintf(out, "LAST DEPLOYED: %s\n", rel.Info.LastDeployed.Format(time.ANSIC))
151 }
152 _, _ = fmt.Fprintf(out, "NAMESPACE: %s\n", coloroutput.ColorizeNamespace(rel.Namespace, s.noColor))
153 _, _ = fmt.Fprintf(out, "STATUS: %s\n", coloroutput.ColorizeStatus(rel.Info.Status, s.noColor))
154 _, _ = fmt.Fprintf(out, "REVISION: %d\n", rel.Version)
155 if s.showMetadata {
156 _, _ = fmt.Fprintf(out, "CHART: %s\n", rel.Chart.Metadata.Name)
157 _, _ = fmt.Fprintf(out, "VERSION: %s\n", rel.Chart.Metadata.Version)
158 _, _ = fmt.Fprintf(out, "APP_VERSION: %s\n", rel.Chart.Metadata.AppVersion)
159 }
160 _, _ = fmt.Fprintf(out, "DESCRIPTION: %s\n", rel.Info.Description)
161
162 if len(rel.Info.Resources) > 0 {
163 buf := new(bytes.Buffer)
164 printFlags := get.NewHumanPrintFlags()
165 typePrinter, _ := printFlags.ToPrinter("")
166 printer := &get.TablePrinter{Delegate: typePrinter}
167
168 var keys []string
169 for key := range rel.Info.Resources {
170 keys = append(keys, key)
171 }
172
173 for _, t := range keys {
174 _, _ = fmt.Fprintf(buf, "==> %s\n", t)
175
176 vk := rel.Info.Resources[t]
177 for _, resource := range vk {
178 if err := printer.PrintObj(resource, buf); err != nil {
179 _, _ = fmt.Fprintf(buf, "failed to print object type %s: %v\n", t, err)
180 }
181 }
182
183 buf.WriteString("\n")
184 }
185
186 _, _ = fmt.Fprintf(out, "RESOURCES:\n%s\n", buf.String())
187 }
188
189 executions := executionsByHookEvent(rel)
190 if tests, ok := executions[releasev1.HookTest]; !ok || len(tests) == 0 {
191 _, _ = fmt.Fprintln(out, "TEST SUITE: None")
192 } else {
193 for _, h := range tests {
194 // Don't print anything if hook has not been initiated
195 if h.LastRun.StartedAt.IsZero() {
196 continue
197 }
198 _, _ = fmt.Fprintf(out, "TEST SUITE: %s\n%s\n%s\n%s\n",
199 h.Name,
200 "Last Started: "+h.LastRun.StartedAt.Format(time.ANSIC),

Callers

nothing calls this directly

Calls 6

getV1ReleaseMethod · 0.95
EncodeYAMLFunction · 0.92
CoalesceValuesFunction · 0.92
executionsByHookEventFunction · 0.85
AsMapMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected