From 029ed15be53269d53515f7d5b32203e1d8c50f18 Mon Sep 17 00:00:00 2001 From: hurf Date: Thu, 30 Jul 2015 16:43:42 +0800 Subject: [PATCH] Better help message for get and describe Add tips for shortcut ns and ep. --- docs/man/man1/kubectl-describe.1 | 6 +++--- docs/man/man1/kubectl-get.1 | 2 +- docs/user-guide/kubectl/kubectl_describe.md | 8 ++++---- docs/user-guide/kubectl/kubectl_get.md | 4 ++-- pkg/kubectl/cmd/cmd.go | 11 ++++++----- pkg/kubectl/cmd/describe.go | 6 +++--- pkg/kubectl/cmd/get.go | 6 ++++-- 7 files changed, 23 insertions(+), 20 deletions(-) diff --git a/docs/man/man1/kubectl-describe.1 b/docs/man/man1/kubectl-describe.1 index 708a03e369a..5a4766103de 100644 --- a/docs/man/man1/kubectl-describe.1 +++ b/docs/man/man1/kubectl-describe.1 @@ -28,9 +28,9 @@ exists, it will output details for every resource that has a name prefixed with .PP Possible resources include (case insensitive): pods (po), services (svc), -replicationcontrollers (rc), nodes (no), events (ev), componentstatuses (cs), -limitranges (limits), persistentvolumes (pv), persistentvolumeclaims (pvc), -resourcequotas (quota) or secrets. +replicationcontrollers (rc), nodes (no), events (ev), limitranges (limits), +persistentvolumes (pv), persistentvolumeclaims (pvc), resourcequotas (quota), +namespaces (ns) or secrets. .SH OPTIONS diff --git a/docs/man/man1/kubectl-get.1 b/docs/man/man1/kubectl-get.1 index 3b198285c7d..7bbe6ac2cf6 100644 --- a/docs/man/man1/kubectl-get.1 +++ b/docs/man/man1/kubectl-get.1 @@ -19,7 +19,7 @@ Display one or many resources. Possible resources include (case insensitive): pods (po), services (svc), replicationcontrollers (rc), nodes (no), events (ev), componentstatuses (cs), limitranges (limits), persistentvolumes (pv), persistentvolumeclaims (pvc), -resourcequotas (quota) or secrets. +resourcequotas (quota), namespaces (ns), endpoints (ep) or secrets. .PP By specifying the output as 'template' and providing a Go template as the value diff --git a/docs/user-guide/kubectl/kubectl_describe.md b/docs/user-guide/kubectl/kubectl_describe.md index 04bd4ea79b9..054e375d02b 100644 --- a/docs/user-guide/kubectl/kubectl_describe.md +++ b/docs/user-guide/kubectl/kubectl_describe.md @@ -49,9 +49,9 @@ will first check for an exact match on RESOURCE and NAME_PREFIX. If no such reso exists, it will output details for every resource that has a name prefixed with NAME_PREFIX Possible resources include (case insensitive): pods (po), services (svc), -replicationcontrollers (rc), nodes (no), events (ev), componentstatuses (cs), -limitranges (limits), persistentvolumes (pv), persistentvolumeclaims (pvc), -resourcequotas (quota) or secrets. +replicationcontrollers (rc), nodes (no), events (ev), limitranges (limits), +persistentvolumes (pv), persistentvolumeclaims (pvc), resourcequotas (quota), +namespaces (ns) or secrets. ``` kubectl describe (RESOURCE NAME_PREFIX | RESOURCE/NAME) @@ -114,7 +114,7 @@ $ kubectl describe pods frontend * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-07-15 01:43:24.778753787 +0000 UTC +###### Auto generated by spf13/cobra at 2015-07-31 07:12:36.111698336 +0000 UTC diff --git a/docs/user-guide/kubectl/kubectl_get.md b/docs/user-guide/kubectl/kubectl_get.md index f347d8b4d33..eb78c905aac 100644 --- a/docs/user-guide/kubectl/kubectl_get.md +++ b/docs/user-guide/kubectl/kubectl_get.md @@ -43,7 +43,7 @@ Display one or many resources. Possible resources include (case insensitive): pods (po), services (svc), replicationcontrollers (rc), nodes (no), events (ev), componentstatuses (cs), limitranges (limits), persistentvolumes (pv), persistentvolumeclaims (pvc), -resourcequotas (quota) or secrets. +resourcequotas (quota), namespaces (ns), endpoints (ep) or secrets. By specifying the output as 'template' and providing a Go template as the value of the --template flag, you can filter the attributes of the fetched resource(s). @@ -125,7 +125,7 @@ $ kubectl get rc/web service/frontend pods/web-pod-13je7 * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-07-15 01:43:24.778535128 +0000 UTC +###### Auto generated by spf13/cobra at 2015-07-30 08:43:29.371131796 +0000 UTC diff --git a/pkg/kubectl/cmd/cmd.go b/pkg/kubectl/cmd/cmd.go index f08e96514c3..73423424b6a 100644 --- a/pkg/kubectl/cmd/cmd.go +++ b/pkg/kubectl/cmd/cmd.go @@ -95,13 +95,14 @@ __custom_func() { * pods (aka 'po') * replicationcontrollers (aka 'rc') * services (aka 'svc') - * nodes (aka 'no') * events (aka 'ev') + * nodes (aka 'no') + * namespaces (aka 'ns') * secrets - * limits - * persistentVolumes (aka 'pv') - * persistentVolumeClaims (aka 'pvc') - * quota + * persistentvolumes (aka 'pv') + * persistentvolumeclaims (aka 'pvc') + * limitranges (aka 'limits') + * resourcequotas (aka 'quota') ` ) diff --git a/pkg/kubectl/cmd/describe.go b/pkg/kubectl/cmd/describe.go index b3719be9383..ed97aa56de1 100644 --- a/pkg/kubectl/cmd/describe.go +++ b/pkg/kubectl/cmd/describe.go @@ -43,9 +43,9 @@ will first check for an exact match on RESOURCE and NAME_PREFIX. If no such reso exists, it will output details for every resource that has a name prefixed with NAME_PREFIX Possible resources include (case insensitive): pods (po), services (svc), -replicationcontrollers (rc), nodes (no), events (ev), componentstatuses (cs), -limitranges (limits), persistentvolumes (pv), persistentvolumeclaims (pvc), -resourcequotas (quota) or secrets.` +replicationcontrollers (rc), nodes (no), events (ev), limitranges (limits), +persistentvolumes (pv), persistentvolumeclaims (pvc), resourcequotas (quota), +namespaces (ns) or secrets.` describe_example = `// Describe a node $ kubectl describe nodes kubernetes-minion-emt8.c.myproject.internal diff --git a/pkg/kubectl/cmd/get.go b/pkg/kubectl/cmd/get.go index c5a67acce25..5a03c967100 100644 --- a/pkg/kubectl/cmd/get.go +++ b/pkg/kubectl/cmd/get.go @@ -35,7 +35,7 @@ const ( Possible resources include (case insensitive): pods (po), services (svc), replicationcontrollers (rc), nodes (no), events (ev), componentstatuses (cs), limitranges (limits), persistentvolumes (pv), persistentvolumeclaims (pvc), -resourcequotas (quota) or secrets. +resourcequotas (quota), namespaces (ns), endpoints (ep) or secrets. By specifying the output as 'template' and providing a Go template as the value of the --template flag, you can filter the attributes of the fetched resource(s).` @@ -100,7 +100,9 @@ func RunGet(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string } if len(args) == 0 { - fmt.Fprint(out, "You must specify the type of resource to get. ", valid_resources) + fmt.Fprint(out, "You must specify the type of resource to get. ", valid_resources, ` * componentstatuses (aka 'cs') + * endpoints (aka 'ep') +`) return cmdutil.UsageError(cmd, "Required resource not specified.") }