Optimize cmd pkg (#384)

Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero 2022-10-05 10:02:24 +08:00 committed by GitHub
parent 3165551f9a
commit 5f699656df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 14 additions and 14 deletions

View File

@ -10,12 +10,12 @@ import (
// NewBuildCmd returns build subcmd
func NewBuildCmd(globalCfg *config.GlobalImpl) *cobra.Command {
buildOptions := config.NewBuildOptions()
buildImpl := config.NewBuildImpl(globalCfg, buildOptions)
cmd := &cobra.Command{
Use: "build",
Short: "Build all resources from state file",
RunE: func(cmd *cobra.Command, args []string) error {
buildImpl := config.NewBuildImpl(globalCfg, buildOptions)
err := config.NewCLIConfigImpl(buildImpl.GlobalImpl)
if err != nil {
return err

View File

@ -10,12 +10,12 @@ import (
// NewChartsCmd returns charts subcmd
func NewChartsCmd(globalCfg *config.GlobalImpl) *cobra.Command {
chartsOptions := config.NewChartsOptions()
chartsImpl := config.NewChartsImpl(globalCfg, chartsOptions)
cmd := &cobra.Command{
Use: "charts",
Short: "DEPRECATED: sync releases from state file (helm upgrade --install)",
RunE: func(cmd *cobra.Command, args []string) error {
chartsImpl := config.NewChartsImpl(globalCfg, chartsOptions)
err := config.NewCLIConfigImpl(chartsImpl.GlobalImpl)
if err != nil {
return err

View File

@ -10,12 +10,12 @@ import (
// NewDeleteCmd returns delete subcmd
func NewDeleteCmd(globalCfg *config.GlobalImpl) *cobra.Command {
deleteOptions := config.NewDeleteOptions()
deleteImpl := config.NewDeleteImpl(globalCfg, deleteOptions)
cmd := &cobra.Command{
Use: "delete",
Short: "DEPRECATED: delete releases from state file (helm delete)",
RunE: func(cmd *cobra.Command, args []string) error {
deleteImpl := config.NewDeleteImpl(globalCfg, deleteOptions)
err := config.NewCLIConfigImpl(deleteImpl.GlobalImpl)
if err != nil {
return err

View File

@ -10,12 +10,12 @@ import (
// NewDepsCmd returns deps subcmd
func NewDepsCmd(globalCfg *config.GlobalImpl) *cobra.Command {
depsOptions := config.NewDepsOptions()
depsImpl := config.NewDepsImpl(globalCfg, depsOptions)
cmd := &cobra.Command{
Use: "deps",
Short: "Update charts based on their requirements",
RunE: func(cmd *cobra.Command, args []string) error {
depsImpl := config.NewDepsImpl(globalCfg, depsOptions)
err := config.NewCLIConfigImpl(depsImpl.GlobalImpl)
if err != nil {
return err

View File

@ -10,12 +10,12 @@ import (
// NewDestroyCmd returns destroy subcmd
func NewDestroyCmd(globalCfg *config.GlobalImpl) *cobra.Command {
destroyOptions := config.NewDestroyOptions()
destroyImpl := config.NewDestroyImpl(globalCfg, destroyOptions)
cmd := &cobra.Command{
Use: "destroy",
Short: "Destroys and then purges releases",
RunE: func(cmd *cobra.Command, args []string) error {
destroyImpl := config.NewDestroyImpl(globalCfg, destroyOptions)
err := config.NewCLIConfigImpl(destroyImpl.GlobalImpl)
if err != nil {
return err

View File

@ -10,12 +10,12 @@ import (
// NewDiffCmd returns diff subcmd
func NewDiffCmd(globalCfg *config.GlobalImpl) *cobra.Command {
diffOptions := config.NewDiffOptions()
diffImpl := config.NewDiffImpl(globalCfg, diffOptions)
cmd := &cobra.Command{
Use: "diff",
Short: "Diff releases defined in state file",
RunE: func(cmd *cobra.Command, args []string) error {
diffImpl := config.NewDiffImpl(globalCfg, diffOptions)
err := config.NewCLIConfigImpl(diffImpl.GlobalImpl)
if err != nil {
return err

View File

@ -10,12 +10,12 @@ import (
// NewFetchCmd returns diff subcmd
func NewFetchCmd(globalCfg *config.GlobalImpl) *cobra.Command {
fetchOptions := config.NewFetchOptions()
fetchImpl := config.NewFetchImpl(globalCfg, fetchOptions)
cmd := &cobra.Command{
Use: "fetch",
Short: "Fetch charts from state file",
RunE: func(cmd *cobra.Command, args []string) error {
fetchImpl := config.NewFetchImpl(globalCfg, fetchOptions)
err := config.NewCLIConfigImpl(fetchImpl.GlobalImpl)
if err != nil {
return err

View File

@ -10,12 +10,12 @@ import (
// NewLintCmd returns lint subcmd
func NewLintCmd(globalCfg *config.GlobalImpl) *cobra.Command {
lintOptions := config.NewLintOptions()
lintImpl := config.NewLintImpl(globalCfg, lintOptions)
cmd := &cobra.Command{
Use: "lint",
Short: "Lint charts from state file (helm lint)",
RunE: func(cmd *cobra.Command, args []string) error {
lintImpl := config.NewLintImpl(globalCfg, lintOptions)
err := config.NewCLIConfigImpl(lintImpl.GlobalImpl)
if err != nil {
return err

View File

@ -10,12 +10,12 @@ import (
// NewListCmd returns list subcmd
func NewListCmd(globalCfg *config.GlobalImpl) *cobra.Command {
listOptions := config.NewListOptions()
listImpl := config.NewListImpl(globalCfg, listOptions)
cmd := &cobra.Command{
Use: "list",
Short: "List releases defined in state file",
RunE: func(cmd *cobra.Command, args []string) error {
listImpl := config.NewListImpl(globalCfg, listOptions)
err := config.NewCLIConfigImpl(listImpl.GlobalImpl)
if err != nil {
return err

View File

@ -10,12 +10,12 @@ import (
// NewReposCmd returns repos subcmd
func NewReposCmd(globalCfg *config.GlobalImpl) *cobra.Command {
reposOptions := config.NewReposOptions()
reposImpl := config.NewReposImpl(globalCfg, reposOptions)
cmd := &cobra.Command{
Use: "repos",
Short: "Repos releases defined in state file",
RunE: func(cmd *cobra.Command, args []string) error {
reposImpl := config.NewReposImpl(globalCfg, reposOptions)
err := config.NewCLIConfigImpl(reposImpl.GlobalImpl)
if err != nil {
return err

View File

@ -10,12 +10,12 @@ import (
// NewStatusCmd returns status subcmd
func NewStatusCmd(globalCfg *config.GlobalImpl) *cobra.Command {
statusOptions := config.NewStatusOptions()
statusImpl := config.NewStatusImpl(globalCfg, statusOptions)
cmd := &cobra.Command{
Use: "status",
Short: "Retrieve status of releases in state file",
RunE: func(cmd *cobra.Command, args []string) error {
statusImpl := config.NewStatusImpl(globalCfg, statusOptions)
err := config.NewCLIConfigImpl(statusImpl.GlobalImpl)
if err != nil {
return err

View File

@ -10,12 +10,12 @@ import (
// NewSyncCmd returns sync subcmd
func NewSyncCmd(globalCfg *config.GlobalImpl) *cobra.Command {
syncOptions := config.NewSyncOptions()
syncImpl := config.NewSyncImpl(globalCfg, syncOptions)
cmd := &cobra.Command{
Use: "sync",
Short: "Sync releases defined in state file",
RunE: func(cmd *cobra.Command, args []string) error {
syncImpl := config.NewSyncImpl(globalCfg, syncOptions)
err := config.NewCLIConfigImpl(syncImpl.GlobalImpl)
if err != nil {
return err

View File

@ -10,12 +10,12 @@ import (
// NewTemplateCmd returm template subcmd
func NewTemplateCmd(globalCfg *config.GlobalImpl) *cobra.Command {
templateOptions := config.NewTemplateOptions()
templateImpl := config.NewTemplateImpl(globalCfg, templateOptions)
cmd := &cobra.Command{
Use: "template",
Short: "Template releases defined in state file",
RunE: func(cmd *cobra.Command, args []string) error {
templateImpl := config.NewTemplateImpl(globalCfg, templateOptions)
err := config.NewCLIConfigImpl(templateImpl.GlobalImpl)
if err != nil {
return err

View File

@ -10,12 +10,12 @@ import (
// NewWriteValuesCmd returns write subcmd
func NewWriteValuesCmd(globalCfg *config.GlobalImpl) *cobra.Command {
writeValuesOptions := config.NewWriteValuesOptions()
writeValuesImpl := config.NewWriteValuesImpl(globalCfg, writeValuesOptions)
cmd := &cobra.Command{
Use: "write-values",
Short: "Write values files for releases. Similar to `helmfile template`, write values files instead of manifests.",
RunE: func(cmd *cobra.Command, args []string) error {
writeValuesImpl := config.NewWriteValuesImpl(globalCfg, writeValuesOptions)
err := config.NewCLIConfigImpl(writeValuesImpl.GlobalImpl)
if err != nil {
return err