mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-04 11:21:57 +02:00
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>
34 lines
662 B
Go
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
|
|
}
|