mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 15:37:24 +00:00
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:
@@ -20,6 +20,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/renstrom/dedent"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||
@@ -35,15 +36,17 @@ type CreateOptions struct {
|
||||
Recursive bool
|
||||
}
|
||||
|
||||
const (
|
||||
create_long = `Create a resource by filename or stdin.
|
||||
var (
|
||||
create_long = dedent.Dedent(`
|
||||
Create a resource by filename or stdin.
|
||||
|
||||
JSON and YAML formats are accepted.`
|
||||
create_example = `# Create a pod using the data in pod.json.
|
||||
kubectl create -f ./pod.json
|
||||
JSON and YAML formats are accepted.`)
|
||||
create_example = dedent.Dedent(`
|
||||
# Create a pod using the data in pod.json.
|
||||
kubectl create -f ./pod.json
|
||||
|
||||
# Create a pod based on the JSON passed into stdin.
|
||||
cat pod.json | kubectl create -f -`
|
||||
# Create a pod based on the JSON passed into stdin.
|
||||
cat pod.json | kubectl create -f -`)
|
||||
)
|
||||
|
||||
func NewCmdCreate(f *cmdutil.Factory, out io.Writer) *cobra.Command {
|
||||
|
||||
Reference in New Issue
Block a user