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" | ||||
| ) | ||||
| 
 | ||||
| // NewApplyCmd returm apply subcmd
 | ||||
| // NewApplyCmd returns apply subcmd
 | ||||
| func NewApplyCmd(globalCfg *config.GlobalImpl) *cobra.Command { | ||||
| 	applyOptions := &config.ApplyOptions{} | ||||
| 	applyImpl := config.NewApplyImpl(globalCfg, applyOptions) | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ import ( | |||
| 	"github.com/spf13/cobra" | ||||
| ) | ||||
| 
 | ||||
| // NewBuildCmd returm build subcmd
 | ||||
| // NewBuildCmd returns build subcmd
 | ||||
| func NewBuildCmd(globalCfg *config.GlobalImpl) *cobra.Command { | ||||
| 	buildOptions := config.NewBuildOptions() | ||||
| 	buildImpl := config.NewBuildImpl(globalCfg, buildOptions) | ||||
|  |  | |||
|  | @ -49,7 +49,7 @@ func NewCacheCleanupSubcommand(cacheImpl *config.CacheImpl) *cobra.Command { | |||
| 	return cmd | ||||
| } | ||||
| 
 | ||||
| // NewCacheCmd returm cache subcmd
 | ||||
| // NewCacheCmd returns cache subcmd
 | ||||
| func NewCacheCmd(globalCfg *config.GlobalImpl) *cobra.Command { | ||||
| 	cacheOptions := config.NewCacheOptions() | ||||
| 	cacheImpl := config.NewCacheImpl(globalCfg, cacheOptions) | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ import ( | |||
| 	"github.com/spf13/cobra" | ||||
| ) | ||||
| 
 | ||||
| // NewChartsCmd returm build subcmd
 | ||||
| // NewChartsCmd returns charts subcmd
 | ||||
| func NewChartsCmd(globalCfg *config.GlobalImpl) *cobra.Command { | ||||
| 	chartsOptions := config.NewChartsOptions() | ||||
| 	chartsImpl := config.NewChartsImpl(globalCfg, chartsOptions) | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ import ( | |||
| 	"github.com/spf13/cobra" | ||||
| ) | ||||
| 
 | ||||
| // NewDeleteCmd returm build subcmd
 | ||||
| // NewDeleteCmd returns delete subcmd
 | ||||
| func NewDeleteCmd(globalCfg *config.GlobalImpl) *cobra.Command { | ||||
| 	deleteOptions := config.NewDeleteOptions() | ||||
| 	deleteImpl := config.NewDeleteImpl(globalCfg, deleteOptions) | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ import ( | |||
| 	"github.com/spf13/cobra" | ||||
| ) | ||||
| 
 | ||||
| // NewDepsCmd returm build subcmd
 | ||||
| // NewDepsCmd returns deps subcmd
 | ||||
| func NewDepsCmd(globalCfg *config.GlobalImpl) *cobra.Command { | ||||
| 	depsOptions := config.NewDepsOptions() | ||||
| 	depsImpl := config.NewDepsImpl(globalCfg, depsOptions) | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ import ( | |||
| 	"github.com/spf13/cobra" | ||||
| ) | ||||
| 
 | ||||
| // NewDestroyCmd returm build subcmd
 | ||||
| // NewDestroyCmd returns destroy subcmd
 | ||||
| func NewDestroyCmd(globalCfg *config.GlobalImpl) *cobra.Command { | ||||
| 	destroyOptions := config.NewDestroyOptions() | ||||
| 	destroyImpl := config.NewDestroyImpl(globalCfg, destroyOptions) | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ import ( | |||
| 	"github.com/spf13/cobra" | ||||
| ) | ||||
| 
 | ||||
| // NewDiffCmd returm build subcmd
 | ||||
| // NewDiffCmd returns diff subcmd
 | ||||
| func NewDiffCmd(globalCfg *config.GlobalImpl) *cobra.Command { | ||||
| 	diffOptions := config.NewDiffOptions() | ||||
| 	diffImpl := config.NewDiffImpl(globalCfg, diffOptions) | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ import ( | |||
| 	"github.com/spf13/cobra" | ||||
| ) | ||||
| 
 | ||||
| // NewFetchCmd returm build subcmd
 | ||||
| // NewFetchCmd returns diff subcmd
 | ||||
| func NewFetchCmd(globalCfg *config.GlobalImpl) *cobra.Command { | ||||
| 	fetchOptions := config.NewFetchOptions() | ||||
| 	fetchImpl := config.NewFetchImpl(globalCfg, fetchOptions) | ||||
|  |  | |||
							
								
								
									
										13
									
								
								cmd/lint.go
								
								
								
								
							
							
						
						
									
										13
									
								
								cmd/lint.go
								
								
								
								
							|  | @ -6,7 +6,7 @@ import ( | |||
| 	"github.com/spf13/cobra" | ||||
| ) | ||||
| 
 | ||||
| // NewLintCmd returm build subcmd
 | ||||
| // NewLintCmd returns lint subcmd
 | ||||
| func NewLintCmd(globalCfg *config.GlobalImpl) *cobra.Command { | ||||
| 	lintOptions := config.NewLintOptions() | ||||
| 	lintImpl := config.NewLintImpl(globalCfg, lintOptions) | ||||
|  | @ -31,10 +31,13 @@ func NewLintCmd(globalCfg *config.GlobalImpl) *cobra.Command { | |||
| 
 | ||||
| 	f := cmd.Flags() | ||||
| 	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.StringVar(&lintOptions.Args, "args", lintOptions.Args, "pass args to helm exec") | ||||
| 	f.StringArrayVar(&lintOptions.Set, "set", lintOptions.Set, "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.BoolVar(&lintOptions.SkipDeps, "skip-deps", false, `skip running "helm repo update" and "helm dependency build"`) | ||||
| 	f.StringVar(&lintOptions.Args, "args", "", "pass args to helm exec") | ||||
| 	f.StringArrayVar(&lintOptions.Set, "set", nil, "additional values 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 | ||||
| } | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ import ( | |||
| 	"github.com/spf13/cobra" | ||||
| ) | ||||
| 
 | ||||
| // NewListCmd returm build subcmd
 | ||||
| // NewListCmd returns list subcmd
 | ||||
| func NewListCmd(globalCfg *config.GlobalImpl) *cobra.Command { | ||||
| 	listOptions := config.NewListOptions() | ||||
| 	listImpl := config.NewListImpl(globalCfg, listOptions) | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ import ( | |||
| 	"github.com/spf13/cobra" | ||||
| ) | ||||
| 
 | ||||
| // NewReposCmd returm build subcmd
 | ||||
| // NewReposCmd returns repos subcmd
 | ||||
| func NewReposCmd(globalCfg *config.GlobalImpl) *cobra.Command { | ||||
| 	reposOptions := config.NewReposOptions() | ||||
| 	reposImpl := config.NewReposImpl(globalCfg, reposOptions) | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ import ( | |||
| 	"github.com/spf13/cobra" | ||||
| ) | ||||
| 
 | ||||
| // NewStatusCmd returm build subcmd
 | ||||
| // NewStatusCmd returns status subcmd
 | ||||
| func NewStatusCmd(globalCfg *config.GlobalImpl) *cobra.Command { | ||||
| 	statusOptions := config.NewStatusOptions() | ||||
| 	statusImpl := config.NewStatusImpl(globalCfg, statusOptions) | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ import ( | |||
| 	"github.com/spf13/cobra" | ||||
| ) | ||||
| 
 | ||||
| // NewSyncCmd returm build subcmd
 | ||||
| // NewSyncCmd returns sync subcmd
 | ||||
| func NewSyncCmd(globalCfg *config.GlobalImpl) *cobra.Command { | ||||
| 	syncOptions := config.NewSyncOptions() | ||||
| 	syncImpl := config.NewSyncImpl(globalCfg, syncOptions) | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ import ( | |||
| 	"github.com/spf13/cobra" | ||||
| ) | ||||
| 
 | ||||
| // NewTemplateCmd returm build subcmd
 | ||||
| // NewTemplateCmd returm template subcmd
 | ||||
| func NewTemplateCmd(globalCfg *config.GlobalImpl) *cobra.Command { | ||||
| 	templateOptions := config.NewTemplateOptions() | ||||
| 	templateImpl := config.NewTemplateImpl(globalCfg, templateOptions) | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ import ( | |||
| 	"github.com/spf13/cobra" | ||||
| ) | ||||
| 
 | ||||
| // NewTestCmd returm build subcmd
 | ||||
| // NewTestCmd returns test subcmd
 | ||||
| func NewTestCmd(globalCfg *config.GlobalImpl) *cobra.Command { | ||||
| 	testOptions := config.NewTestOptions() | ||||
| 	testImpl := config.NewTestImpl(globalCfg, testOptions) | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ import ( | |||
| 	"github.com/spf13/cobra" | ||||
| ) | ||||
| 
 | ||||
| // NewVersionCmd returm build subcmd
 | ||||
| // NewVersionCmd returns version subcmd
 | ||||
| func NewVersionCmd() *cobra.Command { | ||||
| 	cmd := &cobra.Command{ | ||||
| 		Use:   "version", | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ import ( | |||
| 	"github.com/spf13/cobra" | ||||
| ) | ||||
| 
 | ||||
| // NewWriteValuesCmd returm build subcmd
 | ||||
| // NewWriteValuesCmd returns write subcmd
 | ||||
| func NewWriteValuesCmd(globalCfg *config.GlobalImpl) *cobra.Command { | ||||
| 	writeValuesOptions := config.NewWriteValuesOptions() | ||||
| 	writeValuesImpl := config.NewWriteValuesImpl(globalCfg, writeValuesOptions) | ||||
|  |  | |||
|  | @ -12,6 +12,13 @@ type LintOptions struct { | |||
| 	Set []string | ||||
| 	// Values is the values flags to pass to helm lint
 | ||||
| 	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
 | ||||
|  | @ -34,46 +41,50 @@ func NewLintImpl(g *GlobalImpl, b *LintOptions) *LintImpl { | |||
| } | ||||
| 
 | ||||
| // Concurrency returns the concurrency
 | ||||
| func (c *LintImpl) Concurrency() int { | ||||
| 	return c.LintOptions.Concurrency | ||||
| func (l *LintImpl) Concurrency() int { | ||||
| 	return l.LintOptions.Concurrency | ||||
| } | ||||
| 
 | ||||
| // SkipDeps returns the skip deps
 | ||||
| func (c *LintImpl) SkipDeps() bool { | ||||
| 	return c.LintOptions.SkipDeps | ||||
| func (l *LintImpl) SkipDeps() bool { | ||||
| 	return l.LintOptions.SkipDeps | ||||
| } | ||||
| 
 | ||||
| // Args returns the args
 | ||||
| func (c *LintImpl) Args() string { | ||||
| 	return c.LintOptions.Args | ||||
| func (l *LintImpl) Args() string { | ||||
| 	return l.LintOptions.Args | ||||
| } | ||||
| 
 | ||||
| // Set returns the Set
 | ||||
| func (c *LintImpl) Set() []string { | ||||
| 	return c.LintOptions.Set | ||||
| func (l *LintImpl) Set() []string { | ||||
| 	return l.LintOptions.Set | ||||
| } | ||||
| 
 | ||||
| // Values returns the Values
 | ||||
| func (c *LintImpl) Values() []string { | ||||
| 	return c.LintOptions.Values | ||||
| func (l *LintImpl) Values() []string { | ||||
| 	return l.LintOptions.Values | ||||
| } | ||||
| 
 | ||||
| // SkipCleanUp returns the skip clean up
 | ||||
| func (c *LintImpl) SkipCleanup() bool { | ||||
| 	return false | ||||
| } | ||||
| 
 | ||||
| // SkipNeeds returns the skip needs
 | ||||
| func (c *LintImpl) SkipNeeds() bool { | ||||
| func (l *LintImpl) SkipCleanup() bool { | ||||
| 	return false | ||||
| } | ||||
| 
 | ||||
| // IncludeNeeds returns the include needs
 | ||||
| func (c *LintImpl) IncludeNeeds() bool { | ||||
| 	return false | ||||
| func (l *LintImpl) IncludeNeeds() bool { | ||||
| 	return l.LintOptions.IncludeNeeds || l.LintOptions.IncludeTransitiveNeeds | ||||
| } | ||||
| 
 | ||||
| // 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 | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue