Add flags about need for lint subcmd (#273)
* fix typo Signed-off-by: yxxhero <aiopsclub@163.com> * add flags about needs for lint subcmd Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
parent
7488d7513e
commit
6a37ae9650
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewApplyCmd returm apply subcmd
|
// NewApplyCmd returns apply subcmd
|
||||||
func NewApplyCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
func NewApplyCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
||||||
applyOptions := &config.ApplyOptions{}
|
applyOptions := &config.ApplyOptions{}
|
||||||
applyImpl := config.NewApplyImpl(globalCfg, applyOptions)
|
applyImpl := config.NewApplyImpl(globalCfg, applyOptions)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewBuildCmd returm build subcmd
|
// NewBuildCmd returns build subcmd
|
||||||
func NewBuildCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
func NewBuildCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
||||||
buildOptions := config.NewBuildOptions()
|
buildOptions := config.NewBuildOptions()
|
||||||
buildImpl := config.NewBuildImpl(globalCfg, buildOptions)
|
buildImpl := config.NewBuildImpl(globalCfg, buildOptions)
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ func NewCacheCleanupSubcommand(cacheImpl *config.CacheImpl) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCacheCmd returm cache subcmd
|
// NewCacheCmd returns cache subcmd
|
||||||
func NewCacheCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
func NewCacheCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
||||||
cacheOptions := config.NewCacheOptions()
|
cacheOptions := config.NewCacheOptions()
|
||||||
cacheImpl := config.NewCacheImpl(globalCfg, cacheOptions)
|
cacheImpl := config.NewCacheImpl(globalCfg, cacheOptions)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewChartsCmd returm build subcmd
|
// NewChartsCmd returns charts subcmd
|
||||||
func NewChartsCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
func NewChartsCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
||||||
chartsOptions := config.NewChartsOptions()
|
chartsOptions := config.NewChartsOptions()
|
||||||
chartsImpl := config.NewChartsImpl(globalCfg, chartsOptions)
|
chartsImpl := config.NewChartsImpl(globalCfg, chartsOptions)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewDeleteCmd returm build subcmd
|
// NewDeleteCmd returns delete subcmd
|
||||||
func NewDeleteCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
func NewDeleteCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
||||||
deleteOptions := config.NewDeleteOptions()
|
deleteOptions := config.NewDeleteOptions()
|
||||||
deleteImpl := config.NewDeleteImpl(globalCfg, deleteOptions)
|
deleteImpl := config.NewDeleteImpl(globalCfg, deleteOptions)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewDepsCmd returm build subcmd
|
// NewDepsCmd returns deps subcmd
|
||||||
func NewDepsCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
func NewDepsCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
||||||
depsOptions := config.NewDepsOptions()
|
depsOptions := config.NewDepsOptions()
|
||||||
depsImpl := config.NewDepsImpl(globalCfg, depsOptions)
|
depsImpl := config.NewDepsImpl(globalCfg, depsOptions)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewDestroyCmd returm build subcmd
|
// NewDestroyCmd returns destroy subcmd
|
||||||
func NewDestroyCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
func NewDestroyCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
||||||
destroyOptions := config.NewDestroyOptions()
|
destroyOptions := config.NewDestroyOptions()
|
||||||
destroyImpl := config.NewDestroyImpl(globalCfg, destroyOptions)
|
destroyImpl := config.NewDestroyImpl(globalCfg, destroyOptions)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewDiffCmd returm build subcmd
|
// NewDiffCmd returns diff subcmd
|
||||||
func NewDiffCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
func NewDiffCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
||||||
diffOptions := config.NewDiffOptions()
|
diffOptions := config.NewDiffOptions()
|
||||||
diffImpl := config.NewDiffImpl(globalCfg, diffOptions)
|
diffImpl := config.NewDiffImpl(globalCfg, diffOptions)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewFetchCmd returm build subcmd
|
// NewFetchCmd returns diff subcmd
|
||||||
func NewFetchCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
func NewFetchCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
||||||
fetchOptions := config.NewFetchOptions()
|
fetchOptions := config.NewFetchOptions()
|
||||||
fetchImpl := config.NewFetchImpl(globalCfg, fetchOptions)
|
fetchImpl := config.NewFetchImpl(globalCfg, fetchOptions)
|
||||||
|
|
|
||||||
13
cmd/lint.go
13
cmd/lint.go
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewLintCmd returm build subcmd
|
// NewLintCmd returns lint subcmd
|
||||||
func NewLintCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
func NewLintCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
||||||
lintOptions := config.NewLintOptions()
|
lintOptions := config.NewLintOptions()
|
||||||
lintImpl := config.NewLintImpl(globalCfg, lintOptions)
|
lintImpl := config.NewLintImpl(globalCfg, lintOptions)
|
||||||
|
|
@ -31,10 +31,13 @@ func NewLintCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
||||||
|
|
||||||
f := cmd.Flags()
|
f := cmd.Flags()
|
||||||
f.IntVar(&lintOptions.Concurrency, "concurrency", 0, "maximum number of concurrent downloads of release charts")
|
f.IntVar(&lintOptions.Concurrency, "concurrency", 0, "maximum number of concurrent downloads of release charts")
|
||||||
f.BoolVar(&lintOptions.SkipDeps, "skip-deps", lintOptions.SkipDeps, `skip running "helm repo update" and "helm dependency build"`)
|
f.BoolVar(&lintOptions.SkipDeps, "skip-deps", false, `skip running "helm repo update" and "helm dependency build"`)
|
||||||
f.StringVar(&lintOptions.Args, "args", lintOptions.Args, "pass args to helm exec")
|
f.StringVar(&lintOptions.Args, "args", "", "pass args to helm exec")
|
||||||
f.StringArrayVar(&lintOptions.Set, "set", lintOptions.Set, "additional values to be merged into the command")
|
f.StringArrayVar(&lintOptions.Set, "set", nil, "additional values to be merged into the command")
|
||||||
f.StringArrayVar(&lintOptions.Values, "values", lintOptions.Values, "additional value files to be merged into the command")
|
f.StringArrayVar(&lintOptions.Values, "values", nil, "additional value files to be merged into the command")
|
||||||
|
f.BoolVar(&lintOptions.SkipNeeds, "skip-needs", false, `do not automatically include releases from the target release's "needs" when --selector/-l flag is provided. Does nothing when when --selector/-l flag is not provided. Defaults to true when --include-needs or --include-transitive-needs is not provided`)
|
||||||
|
f.BoolVar(&lintOptions.IncludeNeeds, "include-needs", false, `automatically include releases from the target release's "needs" when --selector/-l flag is provided. Does nothing when when --selector/-l flag is not provided`)
|
||||||
|
f.BoolVar(&lintOptions.IncludeTransitiveNeeds, "include-transitive-needs", false, `like --include-needs, but also includes transitive needs (needs of needs). Does nothing when when --selector/-l flag is not provided. Overrides exclusions of other selectors and conditions.`)
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewListCmd returm build subcmd
|
// NewListCmd returns list subcmd
|
||||||
func NewListCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
func NewListCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
||||||
listOptions := config.NewListOptions()
|
listOptions := config.NewListOptions()
|
||||||
listImpl := config.NewListImpl(globalCfg, listOptions)
|
listImpl := config.NewListImpl(globalCfg, listOptions)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewReposCmd returm build subcmd
|
// NewReposCmd returns repos subcmd
|
||||||
func NewReposCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
func NewReposCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
||||||
reposOptions := config.NewReposOptions()
|
reposOptions := config.NewReposOptions()
|
||||||
reposImpl := config.NewReposImpl(globalCfg, reposOptions)
|
reposImpl := config.NewReposImpl(globalCfg, reposOptions)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewStatusCmd returm build subcmd
|
// NewStatusCmd returns status subcmd
|
||||||
func NewStatusCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
func NewStatusCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
||||||
statusOptions := config.NewStatusOptions()
|
statusOptions := config.NewStatusOptions()
|
||||||
statusImpl := config.NewStatusImpl(globalCfg, statusOptions)
|
statusImpl := config.NewStatusImpl(globalCfg, statusOptions)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewSyncCmd returm build subcmd
|
// NewSyncCmd returns sync subcmd
|
||||||
func NewSyncCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
func NewSyncCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
||||||
syncOptions := config.NewSyncOptions()
|
syncOptions := config.NewSyncOptions()
|
||||||
syncImpl := config.NewSyncImpl(globalCfg, syncOptions)
|
syncImpl := config.NewSyncImpl(globalCfg, syncOptions)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewTemplateCmd returm build subcmd
|
// NewTemplateCmd returm template subcmd
|
||||||
func NewTemplateCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
func NewTemplateCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
||||||
templateOptions := config.NewTemplateOptions()
|
templateOptions := config.NewTemplateOptions()
|
||||||
templateImpl := config.NewTemplateImpl(globalCfg, templateOptions)
|
templateImpl := config.NewTemplateImpl(globalCfg, templateOptions)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewTestCmd returm build subcmd
|
// NewTestCmd returns test subcmd
|
||||||
func NewTestCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
func NewTestCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
||||||
testOptions := config.NewTestOptions()
|
testOptions := config.NewTestOptions()
|
||||||
testImpl := config.NewTestImpl(globalCfg, testOptions)
|
testImpl := config.NewTestImpl(globalCfg, testOptions)
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewVersionCmd returm build subcmd
|
// NewVersionCmd returns version subcmd
|
||||||
func NewVersionCmd() *cobra.Command {
|
func NewVersionCmd() *cobra.Command {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "version",
|
Use: "version",
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewWriteValuesCmd returm build subcmd
|
// NewWriteValuesCmd returns write subcmd
|
||||||
func NewWriteValuesCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
func NewWriteValuesCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
||||||
writeValuesOptions := config.NewWriteValuesOptions()
|
writeValuesOptions := config.NewWriteValuesOptions()
|
||||||
writeValuesImpl := config.NewWriteValuesImpl(globalCfg, writeValuesOptions)
|
writeValuesImpl := config.NewWriteValuesImpl(globalCfg, writeValuesOptions)
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,13 @@ type LintOptions struct {
|
||||||
Set []string
|
Set []string
|
||||||
// Values is the values flags to pass to helm lint
|
// Values is the values flags to pass to helm lint
|
||||||
Values []string
|
Values []string
|
||||||
|
// SkipNeeds is the skip needs flag
|
||||||
|
SkipNeeds bool
|
||||||
|
// IncludeNeeds is the include needs flag
|
||||||
|
IncludeNeeds bool
|
||||||
|
// IncludeTransitiveNeeds is the include transitive needs flag
|
||||||
|
IncludeTransitiveNeeds bool
|
||||||
|
// SkipDeps is the skip deps flag
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewLintOptions creates a new Apply
|
// NewLintOptions creates a new Apply
|
||||||
|
|
@ -34,46 +41,50 @@ func NewLintImpl(g *GlobalImpl, b *LintOptions) *LintImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Concurrency returns the concurrency
|
// Concurrency returns the concurrency
|
||||||
func (c *LintImpl) Concurrency() int {
|
func (l *LintImpl) Concurrency() int {
|
||||||
return c.LintOptions.Concurrency
|
return l.LintOptions.Concurrency
|
||||||
}
|
}
|
||||||
|
|
||||||
// SkipDeps returns the skip deps
|
// SkipDeps returns the skip deps
|
||||||
func (c *LintImpl) SkipDeps() bool {
|
func (l *LintImpl) SkipDeps() bool {
|
||||||
return c.LintOptions.SkipDeps
|
return l.LintOptions.SkipDeps
|
||||||
}
|
}
|
||||||
|
|
||||||
// Args returns the args
|
// Args returns the args
|
||||||
func (c *LintImpl) Args() string {
|
func (l *LintImpl) Args() string {
|
||||||
return c.LintOptions.Args
|
return l.LintOptions.Args
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set returns the Set
|
// Set returns the Set
|
||||||
func (c *LintImpl) Set() []string {
|
func (l *LintImpl) Set() []string {
|
||||||
return c.LintOptions.Set
|
return l.LintOptions.Set
|
||||||
}
|
}
|
||||||
|
|
||||||
// Values returns the Values
|
// Values returns the Values
|
||||||
func (c *LintImpl) Values() []string {
|
func (l *LintImpl) Values() []string {
|
||||||
return c.LintOptions.Values
|
return l.LintOptions.Values
|
||||||
}
|
}
|
||||||
|
|
||||||
// SkipCleanUp returns the skip clean up
|
// SkipCleanUp returns the skip clean up
|
||||||
func (c *LintImpl) SkipCleanup() bool {
|
func (l *LintImpl) SkipCleanup() bool {
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// SkipNeeds returns the skip needs
|
|
||||||
func (c *LintImpl) SkipNeeds() bool {
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// IncludeNeeds returns the include needs
|
// IncludeNeeds returns the include needs
|
||||||
func (c *LintImpl) IncludeNeeds() bool {
|
func (l *LintImpl) IncludeNeeds() bool {
|
||||||
return false
|
return l.LintOptions.IncludeNeeds || l.LintOptions.IncludeTransitiveNeeds
|
||||||
}
|
}
|
||||||
|
|
||||||
// IncludeTransitiveNeeds returns the include transitive needs
|
// IncludeTransitiveNeeds returns the include transitive needs
|
||||||
func (c *LintImpl) IncludeTransitiveNeeds() bool {
|
func (l *LintImpl) IncludeTransitiveNeeds() bool {
|
||||||
|
return l.LintOptions.IncludeTransitiveNeeds
|
||||||
|
}
|
||||||
|
|
||||||
|
// SkipNeeds returns the skip needs
|
||||||
|
func (l *LintImpl) SkipNeeds() bool {
|
||||||
|
if !l.LintOptions.IncludeNeeds {
|
||||||
|
return l.LintOptions.SkipNeeds
|
||||||
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue