Skip to content

Commit

Permalink
Rename Enable/Disable to Add/Delete (#2298)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cortey authored Dec 20, 2024
1 parent de50279 commit 9400f3f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
)

type enableConfig struct {
type addConfig struct {
*cmdcommon.KymaConfig

module string
Expand All @@ -18,19 +18,19 @@ type enableConfig struct {
defaultCR bool
}

func newEnableCMD(kymaConfig *cmdcommon.KymaConfig) *cobra.Command {
cfg := enableConfig{
func newAddCMD(kymaConfig *cmdcommon.KymaConfig) *cobra.Command {
cfg := addConfig{
KymaConfig: kymaConfig,
}

cmd := &cobra.Command{
Use: "enable <module>",
Short: "Enable module.",
Long: "Use this command to enable module.",
Use: "add <module>",
Short: "Add module.",
Long: "Use this command to add module.",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
cfg.module = args[0]
clierror.Check(runEnable(&cfg))
clierror.Check(runAdd(&cfg))
},
}

Expand All @@ -43,7 +43,7 @@ func newEnableCMD(kymaConfig *cmdcommon.KymaConfig) *cobra.Command {
return cmd
}

func runEnable(cfg *enableConfig) clierror.Error {
func runAdd(cfg *addConfig) clierror.Error {
client, clierr := cfg.GetKubeClientWithClierr()
if clierr != nil {
return clierr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,32 @@ import (
"github.com/spf13/cobra"
)

type disableConfig struct {
type deleteConfig struct {
*cmdcommon.KymaConfig

module string
}

func newDisableCMD(kymaConfig *cmdcommon.KymaConfig) *cobra.Command {
cfg := disableConfig{
func newDeleteCMD(kymaConfig *cmdcommon.KymaConfig) *cobra.Command {
cfg := deleteConfig{
KymaConfig: kymaConfig,
}

cmd := &cobra.Command{
Use: "disable <module>",
Short: "Disable module",
Long: "Use this command to disable module",
Use: "delete <module>",
Short: "Delete module",
Long: "Use this command to delete module",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
cfg.module = args[0]
clierror.Check(runDisable(&cfg))
clierror.Check(runDelete(&cfg))
},
}

return cmd
}

func runDisable(cfg *disableConfig) clierror.Error {
func runDelete(cfg *deleteConfig) clierror.Error {
client, clierr := cfg.GetKubeClientWithClierr()
if clierr != nil {
return clierr
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/alpha/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ func NewModuleCMD(kymaConfig *cmdcommon.KymaConfig) *cobra.Command {
}

cmd.AddCommand(newListCMD(kymaConfig))
cmd.AddCommand(newEnableCMD(kymaConfig))
cmd.AddCommand(newDisableCMD(kymaConfig))
cmd.AddCommand(newAddCMD(kymaConfig))
cmd.AddCommand(newDeleteCMD(kymaConfig))

return cmd
}

0 comments on commit 9400f3f

Please sign in to comment.