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
func NewListCmd(globalCfg *config.GlobalImpl) *cobra.Command {
var skipCharts bool
listOptions := config.NewListOptions()
listImpl := config.NewListImpl(globalCfg, listOptions)
@ -17,8 +16,6 @@ func NewListCmd(globalCfg *config.GlobalImpl) *cobra.Command {
Use: "list",
Short: "List releases defined in state file",
RunE: func(cmd *cobra.Command, args []string) error {
listOptions.WithPreparedCharts = !skipCharts
err := config.NewCLIConfigImpl(listImpl.GlobalImpl)
if err != nil {
return err
@ -35,7 +32,7 @@ func NewListCmd(globalCfg *config.GlobalImpl) *cobra.Command {
f := cmd.Flags()
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")
return cmd

View File

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

View File

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

View File

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

View File

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

View File

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