Merge pull request #2677 from Fish-pro/karmadactl-long

Add a description for the karmadactl subcommand
This commit is contained in:
karmada-bot 2022-10-26 17:47:20 +08:00 committed by GitHub
commit 4df5e7baf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 1 deletions

View File

@ -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),

View File

@ -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),

View File

@ -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),