mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 07:27:21 +00:00
Change all cobra commands to use the example section
This will output the examples in their own section, rather than as part of the 'long' synposis.
This commit is contained in:
@@ -28,14 +28,8 @@ import (
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||
)
|
||||
|
||||
func (f *Factory) NewCmdDelete(out io.Writer) *cobra.Command {
|
||||
flags := &struct {
|
||||
Filenames util.StringList
|
||||
}{}
|
||||
cmd := &cobra.Command{
|
||||
Use: "delete ([-f filename] | (<resource> [(<id> | -l <label> | --all)]",
|
||||
Short: "Delete a resource by filename, stdin, or resource and ID.",
|
||||
Long: `Delete a resource by filename, stdin, resource and ID, or by resources and label selector.
|
||||
const (
|
||||
delete_long = `Delete a resource by filename, stdin, resource and ID, or by resources and label selector.
|
||||
|
||||
JSON and YAML formats are accepted.
|
||||
|
||||
@@ -44,25 +38,32 @@ arguments are used and the filename is ignored.
|
||||
|
||||
Note that the delete command does NOT do resource version checks, so if someone
|
||||
submits an update to a resource right when you submit a delete, their update
|
||||
will be lost along with the rest of the resource.
|
||||
will be lost along with the rest of the resource.`
|
||||
delete_example = `// Delete a pod using the type and ID specified in pod.json.
|
||||
$ kubectl delete -f pod.json
|
||||
|
||||
Examples:
|
||||
// Delete a pod based on the type and ID in the JSON passed into stdin.
|
||||
$ cat pod.json | kubectl delete -f -
|
||||
|
||||
// Delete a pod using the type and ID specified in pod.json.
|
||||
$ kubectl delete -f pod.json
|
||||
// Delete pods and services with label name=myLabel.
|
||||
$ kubectl delete pods,services -l name=myLabel
|
||||
|
||||
// Delete a pod based on the type and ID in the JSON passed into stdin.
|
||||
$ cat pod.json | kubectl delete -f -
|
||||
// Delete a pod with ID 1234-56-7890-234234-456456.
|
||||
$ kubectl delete pod 1234-56-7890-234234-456456
|
||||
|
||||
// Delete pods and services with label name=myLabel.
|
||||
$ kubectl delete pods,services -l name=myLabel
|
||||
|
||||
// Delete a pod with ID 1234-56-7890-234234-456456.
|
||||
$ kubectl delete pod 1234-56-7890-234234-456456
|
||||
|
||||
// Delete all pods
|
||||
$ kubectl delete pods --all`,
|
||||
// Delete all pods
|
||||
$ kubectl delete pods --all`
|
||||
)
|
||||
|
||||
func (f *Factory) NewCmdDelete(out io.Writer) *cobra.Command {
|
||||
flags := &struct {
|
||||
Filenames util.StringList
|
||||
}{}
|
||||
cmd := &cobra.Command{
|
||||
Use: "delete ([-f filename] | (<resource> [(<id> | -l <label> | --all)]",
|
||||
Short: "Delete a resource by filename, stdin, or resource and ID.",
|
||||
Long: delete_long,
|
||||
Example: delete_example,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdNamespace, err := f.DefaultNamespace(cmd)
|
||||
checkErr(err)
|
||||
|
||||
Reference in New Issue
Block a user