Skip to content

Commit

Permalink
rename_enable_to_add
Browse files Browse the repository at this point in the history
  • Loading branch information
Cortey committed Dec 20, 2024
1 parent de50279 commit 44494a5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
16 changes: 8 additions & 8 deletions internal/cmd/alpha/module/disable.go
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 removeConfig struct {
*cmdcommon.KymaConfig

module string
}

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

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

return cmd
}

func runDisable(cfg *disableConfig) clierror.Error {
func runRemove(cfg *removeConfig) clierror.Error {
client, clierr := cfg.GetKubeClientWithClierr()
if clierr != nil {
return clierr
Expand Down
16 changes: 8 additions & 8 deletions internal/cmd/alpha/module/enable.go
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
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(newRemoveCMD(kymaConfig))

return cmd
}

0 comments on commit 44494a5

Please sign in to comment.