Files
helmfile/pkg/app/formatters.go
T
Christoph PetrauschandYusuke Kuoka 346e318fd0 Correct enabled property in helmfile list (#1921)
Use the value of the `condition` field instead of the `installed` field of a release in the `enabled` column of helmfile list.
The value of the `installed` field is shown in a new `installed` column.

Fixes #1920

Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
2022-01-10 17:24:07 +09:00

34 lines
662 B
Go

package app
import (
"encoding/json"
"fmt"
"github.com/gosuri/uitable"
)
func FormatAsTable(releases []*HelmRelease) error {
table := uitable.New()
table.AddRow("NAME", "NAMESPACE", "ENABLED", "INSTALLED", "LABELS", "CHART", "VERSION")
for _, r := range releases {
table.AddRow(r.Name, r.Namespace, fmt.Sprintf("%t", r.Enabled), fmt.Sprintf("%t", r.Installed), r.Labels, r.Chart, r.Version)
}
fmt.Println(table.String())
return nil
}
func FormatAsJson(releases []*HelmRelease) error {
output, err := json.Marshal(releases)
if err != nil {
return fmt.Errorf("error generating json: %v", err)
}
fmt.Println(string(output))
return nil
}