diff --git a/pkg/karmadactl/describe.go b/pkg/karmadactl/describe.go index 63336d520..e3c997820 100644 --- a/pkg/karmadactl/describe.go +++ b/pkg/karmadactl/describe.go @@ -15,6 +15,19 @@ import ( ) var ( + describeLong = templates.LongDesc(` + Show details of a specific resource or group of resources in a member cluster. + + Print a detailed description of the selected resources, including related + resources such as events or controllers. You may select a single object by name, + all objects of that type, provide a name prefix, or label selector. For example: + + $ %[1]s describe TYPE NAME_PREFIX + + will first check for an exact match on TYPE and NAME_PREFIX. If no such + resource exists, it will output details for every resource that has a name + prefixed with NAME_PREFIX.`) + describeExample = templates.Examples(` # Describe a pod in cluster(member1) %[1]s describe pods/nginx -C=member1 @@ -50,6 +63,7 @@ func NewCmdDescribe(f util.Factory, parentCommand string, streams genericcliopti cmd := &cobra.Command{ Use: "describe (-f FILENAME | TYPE [NAME_PREFIX | -l label] | TYPE/NAME) (-C CLUSTER)", Short: "Show details of a specific resource or group of resources in a cluster", + Long: fmt.Sprintf(describeLong, parentCommand), SilenceUsage: true, DisableFlagsInUseLine: true, Example: fmt.Sprintf(describeExample, parentCommand), diff --git a/pkg/karmadactl/get.go b/pkg/karmadactl/get.go index bda6af4b6..7ba78987d 100644 --- a/pkg/karmadactl/get.go +++ b/pkg/karmadactl/get.go @@ -56,6 +56,17 @@ var ( getShort = `Display one or many resources` + getLong = templates.LongDesc(` + Display one or many resources in member clusters. + + Prints a table of the most important information about the specified resources. + You can filter the list using a label selector and the --selector flag. If the + desired resource type is namespaced you will only see results in your current + namespace unless you pass --all-namespaces. + + 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 resources.`) + getExample = templates.Examples(` # List all pods in ps output format %[1]s get pods @@ -88,6 +99,7 @@ func NewCmdGet(f util.Factory, parentCommand string, streams genericclioptions.I cmd := &cobra.Command{ Use: "get [NAME | -l label | -n namespace]", Short: getShort, + Long: getLong, SilenceUsage: true, DisableFlagsInUseLine: true, Example: fmt.Sprintf(getExample, parentCommand), diff --git a/pkg/karmadactl/logs.go b/pkg/karmadactl/logs.go index b28efa422..d75dfbfd4 100644 --- a/pkg/karmadactl/logs.go +++ b/pkg/karmadactl/logs.go @@ -17,8 +17,13 @@ const ( ) var ( + logsLong = templates.LongDesc(` + Print the logs for a container in a pod in a member cluster or specified resource. If the pod has + only one container, the container name is optional.`) + logsUsageErrStr = fmt.Sprintf("expected '%s'.\nPOD or TYPE/NAME is a required argument for the logs command", logsUsageStr) - logsExample = templates.Examples(` + + logsExample = templates.Examples(` # Return snapshot logs from pod nginx with only one container in cluster(member1) %[1]s logs nginx -C=member1 @@ -53,6 +58,7 @@ func NewCmdLogs(f util.Factory, parentCommand string, streams genericclioptions. cmd := &cobra.Command{ Use: logsUsageStr, Short: "Print the logs for a container in a pod in a cluster", + Long: logsLong, SilenceUsage: true, DisableFlagsInUseLine: true, Example: fmt.Sprintf(logsExample, parentCommand),