Use dedent for the kubectl commands

The one side effect is that for the "kubectl help" commands a newline
is prepended to output, which will alter the yaml output.

Here we use dedent to format the code to match the output.

hack/update-generated-docs.sh has been run and the affected files have
been added.

Note: for describe.go we added a period to the end of an output message.
This commit is contained in:
Michael Rubin
2016-05-20 10:49:56 -07:00
parent 77cfa34fd9
commit 760b04e294
44 changed files with 686 additions and 548 deletions

View File

@@ -21,6 +21,7 @@ import (
"io"
"time"
"github.com/renstrom/dedent"
"github.com/spf13/cobra"
"k8s.io/kubernetes/pkg/api"
@@ -38,36 +39,38 @@ type DeleteOptions struct {
Recursive bool
}
const (
delete_long = `Delete resources by filenames, stdin, resources and names, or by resources and label selector.
var (
delete_long = dedent.Dedent(`
Delete resources by filenames, stdin, resources and names, or by resources and label selector.
JSON and YAML formats are accepted.
JSON and YAML formats are accepted.
Only one type of the arguments may be specified: filenames, resources and names, or resources and label selector
Only one type of the arguments may be specified: filenames, resources and names, or resources and label selector
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.`
delete_example = `# Delete a pod using the type and name specified in pod.json.
kubectl delete -f ./pod.json
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.`)
delete_example = dedent.Dedent(`
# Delete a pod using the type and name specified in pod.json.
kubectl delete -f ./pod.json
# Delete a pod based on the type and name in the JSON passed into stdin.
cat pod.json | kubectl delete -f -
# Delete a pod based on the type and name in the JSON passed into stdin.
cat pod.json | kubectl delete -f -
# Delete pods and services with same names "baz" and "foo"
kubectl delete pod,service baz foo
# Delete pods and services with same names "baz" and "foo"
kubectl delete pod,service baz foo
# Delete pods and services with label name=myLabel.
kubectl delete pods,services -l name=myLabel
# Delete pods and services with label name=myLabel.
kubectl delete pods,services -l name=myLabel
# Delete a pod immediately (no graceful shutdown)
kubectl delete pod foo --now
# Delete a pod immediately (no graceful shutdown)
kubectl delete pod foo --now
# Delete a pod with UID 1234-56-7890-234234-456456.
kubectl delete pod 1234-56-7890-234234-456456
# Delete a pod with UID 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 NewCmdDelete(f *cmdutil.Factory, out io.Writer) *cobra.Command {