From b118db0a172f213d02e4b19f6dbf289e558e8158 Mon Sep 17 00:00:00 2001 From: lojies Date: Tue, 6 Sep 2016 15:49:20 +0800 Subject: [PATCH] Use dedent for completion.go --- pkg/kubectl/cmd/completion.go | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/pkg/kubectl/cmd/completion.go b/pkg/kubectl/cmd/completion.go index f7017daf667..635db911d2b 100644 --- a/pkg/kubectl/cmd/completion.go +++ b/pkg/kubectl/cmd/completion.go @@ -20,33 +20,36 @@ import ( "bytes" "io" + "github.com/renstrom/dedent" "github.com/spf13/cobra" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" ) -const ( - completion_long = `Output shell completion code for the given shell (bash or zsh). +var ( + completion_long = dedent.Dedent(` + Output shell completion code for the given shell (bash or zsh). -This command prints shell code which must be evaluation to provide interactive -completion of kubectl commands. -` - completion_example = ` -$ source <(kubectl completion bash) + This command prints shell code which must be evaluation to provide interactive + completion of kubectl commands. + `) -will load the kubectl completion code for bash. Note that this depends on the -bash-completion framework. It must be sourced before sourcing the kubectl -completion, e.g. on the Mac: + completion_example = dedent.Dedent(` + $ source <(kubectl completion bash) -$ brew install bash-completion -$ source $(brew --prefix)/etc/bash_completion -$ source <(kubectl completion bash) + will load the kubectl completion code for bash. Note that this depends on the + bash-completion framework. It must be sourced before sourcing the kubectl + completion, e.g. on the Mac: -If you use zsh*, the following will load kubectl zsh completion: + $ brew install bash-completion + $ source $(brew --prefix)/etc/bash_completion + $ source <(kubectl completion bash) -$ source <(kubectl completion zsh) + If you use zsh*, the following will load kubectl zsh completion: -* zsh completions are only supported in versions of zsh >= 5.2` + $ source <(kubectl completion zsh) + + * zsh completions are only supported in versions of zsh >= 5.2`) ) var (