From b259c873b76cb82df1df8d5679b744c702ef53e5 Mon Sep 17 00:00:00 2001 From: Brendan Burns Date: Tue, 9 Jun 2015 15:04:56 -0700 Subject: [PATCH] Add a better message if the user doesn't specify a resource type. --- pkg/kubectl/cmd/get.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pkg/kubectl/cmd/get.go b/pkg/kubectl/cmd/get.go index ed7088287df..8cfdc54749c 100644 --- a/pkg/kubectl/cmd/get.go +++ b/pkg/kubectl/cmd/get.go @@ -17,6 +17,7 @@ limitations under the License. package cmd import ( + "errors" "fmt" "io" @@ -94,6 +95,23 @@ func RunGet(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string return err } + if len(args) == 0 { + fmt.Fprint(out, ` +You must specify the type of resource to get. Valid resource types include: + * pods (aka 'po') + * replicationcontrollers (aka 'rc') + * services + * nodes (aka 'no') + * events (aka 'ev') + * secrets + * limits + * persistentVolumes (aka 'pv') + * persistentVolumeClaims (aka 'pvc') + * quota +`) + return errors.New("Required resource not specified.") + } + // handle watch separately since we cannot watch multiple resource types isWatch, isWatchOnly := cmdutil.GetFlagBool(cmd, "watch"), cmdutil.GetFlagBool(cmd, "watch-only") if isWatch || isWatchOnly {