mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 07:57:35 +00:00
Move printing the valid resource types to a function
Should be calculated from discovery in the future. Also improve descriptions on the affected commands.
This commit is contained in:
@@ -37,20 +37,19 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
describe_long = templates.LongDesc(`
|
||||
Show details of a specific resource or group of resources.
|
||||
It includes the uninitialized objects, unless --include-uninitialized=false is explicitly set.
|
||||
This command joins many API calls together to form a detailed description of a
|
||||
given resource or group of resources.
|
||||
describeLong = templates.LongDesc(`
|
||||
Show details of a specific resource or group of resources
|
||||
|
||||
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:
|
||||
|
||||
$ kubectl 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.
|
||||
exists, it will output details for every resource that has a name prefixed with NAME_PREFIX.`)
|
||||
|
||||
` + validResources)
|
||||
|
||||
describe_example = templates.Examples(i18n.T(`
|
||||
describeExample = templates.Examples(i18n.T(`
|
||||
# Describe a node
|
||||
kubectl describe nodes kubernetes-node-emt8.c.myproject.internal
|
||||
|
||||
@@ -83,8 +82,8 @@ func NewCmdDescribe(f cmdutil.Factory, out, cmdErr io.Writer) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "describe (-f FILENAME | TYPE [NAME_PREFIX | -l label] | TYPE/NAME)",
|
||||
Short: i18n.T("Show details of a specific resource or group of resources"),
|
||||
Long: describe_long,
|
||||
Example: describe_example,
|
||||
Long: describeLong + "\n\n" + cmdutil.ValidResourceTypeList(f),
|
||||
Example: describeExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
err := RunDescribe(f, out, cmdErr, cmd, args, options, describerSettings)
|
||||
cmdutil.CheckErr(err)
|
||||
@@ -113,7 +112,7 @@ func RunDescribe(f cmdutil.Factory, out, cmdErr io.Writer, cmd *cobra.Command, a
|
||||
enforceNamespace = false
|
||||
}
|
||||
if len(args) == 0 && cmdutil.IsFilenameSliceEmpty(options.Filenames) {
|
||||
fmt.Fprint(cmdErr, "You must specify the type of resource to describe. ", validResources)
|
||||
fmt.Fprint(cmdErr, "You must specify the type of resource to describe. ", cmdutil.ValidResourceTypeList(f))
|
||||
return cmdutil.UsageErrorf(cmd, "Required resource not specified.")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user