mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-19 08:40:42 +00:00
Details added in kubectl explain help
This commit is contained in:
parent
86d786090a
commit
8c06ca68d7
@ -35,20 +35,22 @@ import (
|
||||
|
||||
var (
|
||||
explainLong = templates.LongDesc(i18n.T(`
|
||||
List the fields for supported resources.
|
||||
Get structure of various resources with their list of fields. For instance pods, nodes, services, etc.
|
||||
|
||||
This command describes the fields associated with each supported API resource.
|
||||
Fields are identified via a simple JSONPath identifier:
|
||||
|
||||
<type>.<fieldName>[.<fieldName>]
|
||||
|
||||
Add the --recursive flag to display all of the fields at once without descriptions.
|
||||
Information about each field is retrieved from the server in OpenAPI format.`))
|
||||
|
||||
explainExamples = templates.Examples(i18n.T(`
|
||||
# Get the documentation of the resource and its fields
|
||||
kubectl explain pods
|
||||
|
||||
# Get all the fields in the resource
|
||||
kubectl explain pods --recursive
|
||||
|
||||
# Get the documentation of a specific field of a resource
|
||||
kubectl explain pods.spec.containers`))
|
||||
|
||||
@ -89,7 +91,7 @@ func NewCmdExplain(parent string, f cmdutil.Factory, streams genericiooptions.IO
|
||||
o := NewExplainOptions(parent, streams)
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "explain RESOURCE",
|
||||
Use: "explain TYPE [--recursive=FALSE|TRUE] [--api-version=api-version-group] [--output=plaintext|plaintext-openapiv2|plaintext-openapiv3]",
|
||||
DisableFlagsInUseLine: true,
|
||||
Short: i18n.T("Get documentation for a resource"),
|
||||
Long: explainLong + "\n\n" + cmdutil.SuggestAPIResources(parent),
|
||||
@ -100,11 +102,11 @@ func NewCmdExplain(parent string, f cmdutil.Factory, streams genericiooptions.IO
|
||||
cmdutil.CheckErr(o.Run())
|
||||
},
|
||||
}
|
||||
cmd.Flags().BoolVar(&o.Recursive, "recursive", o.Recursive, "Print the fields of fields (Currently only 1 level deep)")
|
||||
cmd.Flags().StringVar(&o.APIVersion, "api-version", o.APIVersion, "Get different explanations for particular API version (API group/version)")
|
||||
cmd.Flags().BoolVar(&o.Recursive, "recursive", o.Recursive, "If present, displays all of the fields at once without descriptions. It print the fields of fields (Currently only 1 level deep)")
|
||||
cmd.Flags().StringVar(&o.APIVersion, "api-version", o.APIVersion, "The resource explanation for particular selected API version/group will be displayed. (For eg. 'kubectl explain pods --api-version=v1'). Defaults to latest API version/group.")
|
||||
|
||||
// Only enable --output as a valid flag if the feature is enabled
|
||||
cmd.Flags().StringVar(&o.OutputFormat, "output", plaintextTemplateName, "Format in which to render the schema (plaintext, plaintext-openapiv2)")
|
||||
cmd.Flags().StringVar(&o.OutputFormat, "output", plaintextTemplateName, "This flag selects which format to render the schema from. Valid values are: (plaintext, plaintext-openapiv2, plaintext-openapiv3). Defaults to openapiv3.")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user