Skip to content

Commit

Permalink
feat: Refactor Enable And Disable Module Commands
Browse files Browse the repository at this point in the history
  • Loading branch information
LeelaChacha committed Jan 20, 2024
1 parent 4ba7a64 commit ef8e523
Show file tree
Hide file tree
Showing 16 changed files with 39 additions and 43 deletions.
9 changes: 5 additions & 4 deletions cmd/kyma/alpha/enable/enable.go → cmd/kyma/alpha/add/add.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package enable
package add

import (
"github.com/kyma-project/cli/cmd/kyma/alpha/enable/module"
"github.com/kyma-project/cli/cmd/kyma/alpha/add/module"
"github.com/kyma-project/cli/internal/cli"
"github.com/spf13/cobra"
)

func NewCmd(o *cli.Options) *cobra.Command {
cmd := &cobra.Command{
Use: "enable",
Short: "Enables a resource in the Kyma cluster.",
Use: "add",
Aliases: []string{"enable"},
Short: "Enables a resource in the Kyma cluster.",
Long: `Use this command to enable a resource in the Kyma cluster.
`,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ func NewCmd(o *Options) *cobra.Command {

cmd := &cobra.Command{
Use: "module [name] [flags]",
Short: "Enables a module in the cluster or in the given Kyma resource.",
Long: `Use this command to enable Kyma modules available in the cluster.
Short: "Activates a module in the cluster or in the given Kyma resource.",
Long: `Use this command to activate Kyma modules available in the cluster.
### Detailed description
Expand All @@ -43,8 +43,8 @@ A module is available when it is released with a ModuleTemplate. The ModuleTempl
`,

Example: `
Enable "my-module" from "alpha" channel in "default-kyma" in "kyma-system" Namespace
kyma alpha enable module my-module -c alpha -n kyma-system -k default-kyma
Add "my-module" from "alpha" channel to "default-kyma" in "kyma-system" Namespace
kyma alpha add module my-module -c alpha -n kyma-system -k default-kyma
`,
RunE: func(cmd *cobra.Command, args []string) error { return c.Run(cmd.Context(), args) },
Aliases: []string{"mod", "mods", "modules"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/kyma-project/lifecycle-manager/api/v1beta2"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/kyma-project/cli/cmd/kyma/alpha/enable/module/mock"
"github.com/kyma-project/cli/cmd/kyma/alpha/add/module/mock"
"github.com/kyma-project/cli/internal/cli/alpha/module"
)

Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions cmd/kyma/alpha/alpha.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package alpha

import (
"github.com/kyma-project/cli/cmd/kyma/alpha/add"
"github.com/kyma-project/cli/cmd/kyma/alpha/create"
"github.com/kyma-project/cli/cmd/kyma/alpha/delete"
"github.com/kyma-project/cli/cmd/kyma/alpha/deploy"
"github.com/kyma-project/cli/cmd/kyma/alpha/disable"
"github.com/kyma-project/cli/cmd/kyma/alpha/enable"
"github.com/kyma-project/cli/cmd/kyma/alpha/list"
"github.com/kyma-project/cli/cmd/kyma/alpha/sign"
"github.com/kyma-project/cli/cmd/kyma/alpha/verify"
Expand All @@ -23,8 +23,8 @@ func NewCmd(o *cli.Options) *cobra.Command {

cmd.AddCommand(create.NewCmd(o))
cmd.AddCommand(list.NewCmd(o))
cmd.AddCommand(enable.NewCmd(o))
cmd.AddCommand(disable.NewCmd(o))
cmd.AddCommand(add.NewCmd(o))
cmd.AddCommand(delete.NewCmd(o))
cmd.AddCommand(deploy.NewCmd(deploy.NewOptions(o)))
cmd.AddCommand(sign.NewCmd(o))
cmd.AddCommand(verify.NewCmd(o))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package disable
package delete

import (
"github.com/kyma-project/cli/cmd/kyma/alpha/disable/module"
"github.com/kyma-project/cli/cmd/kyma/alpha/delete/module"
"github.com/kyma-project/cli/internal/cli"
"github.com/spf13/cobra"
)

func NewCmd(o *cli.Options) *cobra.Command {
cmd := &cobra.Command{
Use: "disable",
Short: "Disables a resource in the Kyma cluster.",
Use: "delete",
Aliases: []string{"disable"},
Short: "Disables a resource in the Kyma cluster.",
Long: `Use this command to disable a resource in the Kyma cluster.
`,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ func NewCmd(o *Options) *cobra.Command {

cmd := &cobra.Command{
Use: "module [name] [flags]",
Short: "Disables a module in the cluster or in the given Kyma resource.",
Long: `Use this command to disable active Kyma modules in the cluster.
Short: "Deactivates a module in the cluster or in the given Kyma resource.",
Long: `Use this command to deactivate Kyma modules in the cluster.
### Detailed description
Expand All @@ -40,8 +40,8 @@ This command disables an active module in the cluster.
`,

Example: `
Disable "my-module" from the "alpha" channel in "default-kyma" in "kyma-system" Namespace
kyma alpha disable module my-module -c alpha -n kyma-system -k default-kyma
Delete "my-module" from the "alpha" channel from "default-kyma" in "kyma-system" Namespace
kyma alpha delete module my-module -c alpha -n kyma-system -k default-kyma
`,
RunE: func(cmd *cobra.Command, args []string) error { return c.Run(cmd.Context(), args) },
Aliases: []string{"mod", "mods", "modules"},
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions docs/gen-docs/kyma_alpha.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ Alpha commands are experimental, unreleased features that should only be used by
## See also

* [kyma](kyma.md) - Controls a Kyma cluster.
* [kyma alpha add](kyma_alpha_add.md) - Enables a resource in the Kyma cluster.
* [kyma alpha create](kyma_alpha_create.md) - Creates resources on the Kyma cluster.
* [kyma alpha delete](kyma_alpha_delete.md) - Disables a resource in the Kyma cluster.
* [kyma alpha deploy](kyma_alpha_deploy.md) - Deploys Kyma on a running Kubernetes cluster.
* [kyma alpha disable](kyma_alpha_disable.md) - Disables a resource in the Kyma cluster.
* [kyma alpha enable](kyma_alpha_enable.md) - Enables a resource in the Kyma cluster.
* [kyma alpha list](kyma_alpha_list.md) - Lists resources on the Kyma cluster.
* [kyma alpha sign](kyma_alpha_sign.md) - Signs all module resources from an unsigned module component descriptor that's hosted in a remote OCI registry
* [kyma alpha verify](kyma_alpha_verify.md) - Verifies all module resources from a signed module component descriptor that's hosted in a remote OCI registry
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: kyma alpha enable
title: kyma alpha add
---

Enables a resource in the Kyma cluster.
Expand All @@ -22,5 +22,5 @@ Use this command to enable a resource in the Kyma cluster.
## See also

* [kyma alpha](kyma_alpha.md) - Experimental commands
* [kyma alpha enable module](kyma_alpha_enable_module.md) - Enables a module in the cluster or in the given Kyma resource.
* [kyma alpha add module](kyma_alpha_add_module.md) - Enables a module in the cluster or in the given Kyma resource.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: kyma alpha enable module
title: kyma alpha add module
---

Enables a module in the cluster or in the given Kyma resource.
Expand All @@ -17,16 +17,13 @@ A module is available when it is released with a ModuleTemplate. The ModuleTempl


```bash
kyma alpha enable module [name] [flags]
kyma alpha add module [name] [flags]
```

## Examples

* Enable "my-module" from "alpha" channel in "default-kyma" in "kyma-system" Namespace
```bash

Enable "my-module" from "alpha" channel in "default-kyma" in "kyma-system" Namespace
kyma alpha enable module my-module -c alpha -n kyma-system -k default-kyma

kyma alpha add module my-module -c alpha -n kyma-system -k default-kyma
```

## Flags
Expand All @@ -53,5 +50,5 @@ Enable "my-module" from "alpha" channel in "default-kyma" in "kyma-system" Names
## See also
* [kyma alpha enable](kyma_alpha_enable.md) - Enables a resource in the Kyma cluster.
* [kyma alpha add](kyma_alpha_add.md) - Enables a resource in the Kyma cluster.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: kyma alpha disable
title: kyma alpha delete
---

Disables a resource in the Kyma cluster.
Expand All @@ -22,5 +22,5 @@ Use this command to disable a resource in the Kyma cluster.
## See also

* [kyma alpha](kyma_alpha.md) - Experimental commands
* [kyma alpha disable module](kyma_alpha_disable_module.md) - Disables a module in the cluster or in the given Kyma resource.
* [kyma alpha delete module](kyma_alpha_delete_module.md) - Disables a module in the cluster or in the given Kyma resource.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: kyma alpha disable module
title: kyma alpha delete module
---

Disables a module in the cluster or in the given Kyma resource.
Expand All @@ -16,16 +16,13 @@ This command disables an active module in the cluster.


```bash
kyma alpha disable module [name] [flags]
kyma alpha delete module [name] [flags]
```

## Examples

* Delete "my-module" from the "alpha" channel in "default-kyma" in "kyma-system" Namespace
```bash

Disable "my-module" from the "alpha" channel in "default-kyma" in "kyma-system" Namespace
kyma alpha disable module my-module -c alpha -n kyma-system -k default-kyma

kyma alpha delete module my-module -c alpha -n kyma-system -k default-kyma
```

## Flags
Expand All @@ -51,5 +48,5 @@ Disable "my-module" from the "alpha" channel in "default-kyma" in "kyma-system"
## See also
* [kyma alpha disable](kyma_alpha_disable.md) - Disables a resource in the Kyma cluster.
* [kyma alpha delete](kyma_alpha_delete.md) - Disables a resource in the Kyma cluster.

0 comments on commit ef8e523

Please sign in to comment.