diff --git a/docs/cli.md b/docs/cli.md index 817aa5c8e..dfe8a1458 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -22,7 +22,7 @@ This document demonstrates how to use the CLI but also shows what happens in `KU * [Install just the KUDO Package without Dependencies](#install-just-the-kudo-package-without-dependencies) * [Install a KUDO Package with Dependencies](#install-a-kudo-package-with-dependencies) * [Install a Package with InstanceName & Parameters](#install-a-package-with-instancename--parameters) - * [List Instances](#list-instances) + * [Get Instances](#get-instances) * [Get the Status of an Instance](#get-the-status-of-an-instance) * [Get the History to PlanExecutions](#get-the-history-to-planexecutions) @@ -49,7 +49,7 @@ Install the plugin from your `$GOPATH/src/github.com/kudobuilder/kudo` root fold | Syntax | Description | |---|---| | `kubectl kudo install [flags]` | Installs a Framework from the official [KUDO repo](https://github.com/kudobuilder/frameworks). | -| `kubectl kudo list instances [flags]` | Show all available instances. | +| `kubectl kudo get instances [flags]` | Show all available instances. | | `kubectl kudo plan status [flags]` | View all available plans. | | `kubectl kudo plan history [flags]` | View all available plans. | | `kubectl kudo version` | Print the current KUDO package version. | @@ -128,17 +128,17 @@ NAME AGE my-kafka-name 6s ``` -### List Instances +### Get Instances -In order to inspect instances deployed by `KUDO`, we can get an overview of all instances running by using the `list` +In order to inspect instances deployed by `KUDO`, we can get an overview of all instances running by using the `get` command. This command has subcommands to filter its result: -`kubectl kudo list instances --namespace= --kubeconfig=<$HOME/.kube/config>` +`kubectl kudo get instances --namespace= --kubeconfig=<$HOME/.kube/config>` Example: ```bash -$ kubectl kudo list instances +$ kubectl kudo get instances List of current instances in namespace "default": . ├── small diff --git a/pkg/kudoctl/cmd/get.go b/pkg/kudoctl/cmd/get.go new file mode 100644 index 000000000..b36457042 --- /dev/null +++ b/pkg/kudoctl/cmd/get.go @@ -0,0 +1,19 @@ +package cmd + +import ( + "github.com/kudobuilder/kudo/pkg/kudoctl/cmd/get" + "github.com/spf13/cobra" +) + +// NewGetCmd creates a new command that lists instances +func NewGetCmd() *cobra.Command { + newCmd := &cobra.Command{ + Use: "get", + Short: "-> Show all available instances.", + Long: `The get command has subcommands to show all available instances.`, + } + + newCmd.AddCommand(get.NewGetInstancesCmd()) + + return newCmd +} diff --git a/pkg/kudoctl/cmd/list/instances.go b/pkg/kudoctl/cmd/get/instances.go similarity index 76% rename from pkg/kudoctl/cmd/list/instances.go rename to pkg/kudoctl/cmd/get/instances.go index 62e64d4de..4316d2ddb 100644 --- a/pkg/kudoctl/cmd/list/instances.go +++ b/pkg/kudoctl/cmd/get/instances.go @@ -1,4 +1,4 @@ -package list +package get import ( "encoding/json" @@ -28,24 +28,24 @@ const ( defaultConfigPath = ".kube/config" ) -// NewListInstancesCmd creates a command that lists the instances in the cluster -func NewListInstancesCmd() *cobra.Command { - listCmd := &cobra.Command{ +// NewGetInstancesCmd creates a command that lists the instances in the cluster +func NewGetInstancesCmd() *cobra.Command { + getCmd := &cobra.Command{ Use: "instances", - Short: "Lists all available instances.", + Short: "Gets all available instances.", Long: ` - # List all available instances - kudoctl list instances`, - Run: instancesListCmd, + # Get all available instances + kudoctl get instances`, + Run: instancesGetCmd, } - listCmd.Flags().StringVar(&kubeConfig, "kubeconfig", "", "The file path to kubernetes configuration file; defaults to $HOME/.kube/config") - listCmd.Flags().StringVar(&namespace, "namespace", "default", "The namespace where the operator watches for changes.") + getCmd.Flags().StringVar(&kubeConfig, "kubeconfig", "", "The file path to kubernetes configuration file; defaults to $HOME/.kube/config") + getCmd.Flags().StringVar(&namespace, "namespace", "default", "The namespace where the operator watches for changes.") - return listCmd + return getCmd } -func instancesListCmd(cmd *cobra.Command, args []string) { +func instancesGetCmd(cmd *cobra.Command, args []string) { mustKubeConfig() @@ -54,7 +54,7 @@ func instancesListCmd(cmd *cobra.Command, args []string) { log.Printf("Flag Error: %v", err) } - p, err := listInstances() + p, err := getInstances() if err != nil { log.Printf("Error: %v", err) } @@ -68,7 +68,7 @@ func instancesListCmd(cmd *cobra.Command, args []string) { } -func listInstances() ([]string, error) { +func getInstances() ([]string, error) { instanceList := make([]string, 0) diff --git a/pkg/kudoctl/cmd/list.go b/pkg/kudoctl/cmd/list.go deleted file mode 100644 index 2a41419c1..000000000 --- a/pkg/kudoctl/cmd/list.go +++ /dev/null @@ -1,19 +0,0 @@ -package cmd - -import ( - "github.com/kudobuilder/kudo/pkg/kudoctl/cmd/list" - "github.com/spf13/cobra" -) - -// NewListCmd creates a new command that lists instances -func NewListCmd() *cobra.Command { - newCmd := &cobra.Command{ - Use: "list", - Short: "-> Show all available instances.", - Long: `The list command has subcommands to show all available instances.`, - } - - newCmd.AddCommand(list.NewListInstancesCmd()) - - return newCmd -} diff --git a/pkg/kudoctl/cmd/root.go b/pkg/kudoctl/cmd/root.go index 215daed16..9ec60091f 100644 --- a/pkg/kudoctl/cmd/root.go +++ b/pkg/kudoctl/cmd/root.go @@ -25,8 +25,8 @@ and serves as an API aggregation layer. # View all plan history of a specific package kubectl kudo plan history [flags] - # List instances - kubectl kudo list instances [flags] + # Get instances + kubectl kudo get instances [flags] # View plan status kubectl kudo plan status [flags] @@ -39,7 +39,7 @@ and serves as an API aggregation layer. } cmd.AddCommand(NewInstallCmd()) - cmd.AddCommand(NewListCmd()) + cmd.AddCommand(NewGetCmd()) cmd.AddCommand(NewPlanCmd()) cmd.AddCommand(NewVersionCmd())