chore: list: withPreparedCharts -> skipCharts

Signed-off-by: Viktor Oreshkin <imselfish@stek29.rocks>
This commit is contained in:
Viktor Oreshkin 2022-09-06 09:54:51 +03:00
parent 4dd73d4efb
commit af52c960f4
6 changed files with 19 additions and 22 deletions

View File

@ -9,7 +9,6 @@ import (
// NewListCmd returns list subcmd // NewListCmd returns list subcmd
func NewListCmd(globalCfg *config.GlobalImpl) *cobra.Command { func NewListCmd(globalCfg *config.GlobalImpl) *cobra.Command {
var skipCharts bool
listOptions := config.NewListOptions() listOptions := config.NewListOptions()
listImpl := config.NewListImpl(globalCfg, listOptions) listImpl := config.NewListImpl(globalCfg, listOptions)
@ -17,8 +16,6 @@ func NewListCmd(globalCfg *config.GlobalImpl) *cobra.Command {
Use: "list", Use: "list",
Short: "List releases defined in state file", Short: "List releases defined in state file",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
listOptions.WithPreparedCharts = !skipCharts
err := config.NewCLIConfigImpl(listImpl.GlobalImpl) err := config.NewCLIConfigImpl(listImpl.GlobalImpl)
if err != nil { if err != nil {
return err return err
@ -35,7 +32,7 @@ func NewListCmd(globalCfg *config.GlobalImpl) *cobra.Command {
f := cmd.Flags() f := cmd.Flags()
f.BoolVar(&listOptions.KeepTempDir, "keep-temp-dir", false, "Keep temporary directory") f.BoolVar(&listOptions.KeepTempDir, "keep-temp-dir", false, "Keep temporary directory")
f.BoolVar(&skipCharts, "skip-charts", false, "don't prepare charts when listing releases") f.BoolVar(&listOptions.SkipCharts, "skip-charts", false, "don't prepare charts when listing releases")
f.StringVar(&listOptions.Output, "output", "", "output releases list as a json string") f.StringVar(&listOptions.Output, "output", "", "output releases list as a json string")
return cmd return cmd

View File

@ -550,7 +550,7 @@ func (a *App) ListReleases(c ListConfigProvider) error {
var stateReleases []*HelmRelease var stateReleases []*HelmRelease
var err error var err error
if c.WithPreparedCharts() { if !c.SkipCharts() {
err = run.withPreparedCharts("list", state.ChartPrepareOptions{ err = run.withPreparedCharts("list", state.ChartPrepareOptions{
SkipRepos: true, SkipRepos: true,
SkipDeps: true, SkipDeps: true,

View File

@ -249,11 +249,11 @@ database my-app true true bitnami/postg
} }
func TestListWithEnvironment(t *testing.T) { func TestListWithEnvironment(t *testing.T) {
t.Run("with prepared charts", func(t *testing.T) { t.Run("with skipCharts=false", func(t *testing.T) {
testListWithEnvironment(t, configImpl{withPreparedCharts: true}) testListWithEnvironment(t, configImpl{skipCharts: false})
}) })
t.Run("without prepared charts", func(t *testing.T) { t.Run("with skipCharts=true", func(t *testing.T) {
testListWithEnvironment(t, configImpl{withPreparedCharts: false}) testListWithEnvironment(t, configImpl{skipCharts: true})
}) })
} }
@ -316,10 +316,10 @@ releases:
} }
func TestListWithJSONOutput(t *testing.T) { func TestListWithJSONOutput(t *testing.T) {
t.Run("with prepared charts", func(t *testing.T) { t.Run("with skipCharts=false", func(t *testing.T) {
testListWithJSONOutput(t, configImpl{withPreparedCharts: true}) testListWithJSONOutput(t, configImpl{skipCharts: false})
}) })
t.Run("without prepared charts", func(t *testing.T) { t.Run("with skipCharts=true", func(t *testing.T) {
testListWithJSONOutput(t, configImpl{withPreparedCharts: false}) testListWithJSONOutput(t, configImpl{skipCharts: true})
}) })
} }

View File

@ -2220,7 +2220,7 @@ type configImpl struct {
skipNeeds bool skipNeeds bool
includeNeeds bool includeNeeds bool
includeTransitiveNeeds bool includeTransitiveNeeds bool
withPreparedCharts bool skipCharts bool
} }
func (c configImpl) Selectors() []string { func (c configImpl) Selectors() []string {
@ -2295,8 +2295,8 @@ func (c configImpl) Output() string {
return c.output return c.output
} }
func (c configImpl) WithPreparedCharts() bool { func (c configImpl) SkipCharts() bool {
return c.withPreparedCharts return c.skipCharts
} }
type applyConfig struct { type applyConfig struct {

View File

@ -236,7 +236,7 @@ type interactive interface {
type ListConfigProvider interface { type ListConfigProvider interface {
Output() string Output() string
WithPreparedCharts() bool SkipCharts() bool
} }
type CacheConfigProvider interface{} type CacheConfigProvider interface{}

View File

@ -6,8 +6,8 @@ type ListOptions struct {
Output string Output string
// KeepTempDir is the keep temp dir flag // KeepTempDir is the keep temp dir flag
KeepTempDir bool KeepTempDir bool
// WithPreparedCharts makes list call `withPreparedCharts` when listing // SkipCharts makes List skip `withPreparedCharts`
WithPreparedCharts bool SkipCharts bool
} }
// NewListOptions creates a new Apply // NewListOptions creates a new Apply
@ -39,7 +39,7 @@ func (c *ListImpl) Output() string {
return c.ListOptions.Output return c.ListOptions.Output
} }
// WithPreparedCharts returns withPreparedCharts flag // SkipCharts returns skipCharts flag
func (c *ListImpl) WithPreparedCharts() bool { func (c *ListImpl) SkipCharts() bool {
return c.ListOptions.WithPreparedCharts return c.ListOptions.SkipCharts
} }