Skip to content

Commit

Permalink
fixes completion command help formatting
Browse files Browse the repository at this point in the history
There is minor issue with completion
command help message indentation.

This patch fixes the indentation as well as
removes the vlidation unwanted messages.
  • Loading branch information
hrishin authored and tekton-robot committed May 17, 2019
1 parent 83fe0ca commit c345fa9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
37 changes: 20 additions & 17 deletions pkg/cmd/completion/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,31 @@ import (
"os"

"github.com/spf13/cobra"
"github.com/tektoncd/cli/pkg/cli"
)

func Command(cli.Params) *cobra.Command {
var cmd = &cobra.Command{
Use: "completion SHELL",
Short: "Prints shell completion scripts",
Long: `
This command prints shell completion code which must be evaluated to provide interactive completion
const(
desc = `
This command prints shell completion code which must be evaluatedto provide
interactive completion
Supported Shells:
- bash
`,
Supported Shells:
- bash
`
eg = `
# generate completion code for bash
tkn completion bash > bash_completion.sh
source bash_completion.sh
`
)
func Command() *cobra.Command {
var cmd = &cobra.Command{
Use: "completion SHELL",
Short: "Prints shell completion scripts",
Long: desc,
Args: exactValidArgs(1),
ValidArgs: []string{"bash"},
Example: `
# generate completion code for bash
tkn completion bash > bash_completion.sh
source bash_completion.sh
`,
Example: eg,
RunE: func(cmd *cobra.Command, args []string) error {

switch args[0] {
case "bash":
return cmd.Root().GenBashCompletion(os.Stdout)
Expand All @@ -65,4 +68,4 @@ func exactValidArgs(n int) cobra.PositionalArgs {
}
return cobra.OnlyValidArgs(cmd, args)
}
}
}
2 changes: 1 addition & 1 deletion pkg/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func Root(p cli.Params) *cobra.Command {
}

cmd.AddCommand(
completion.Command(p),
completion.Command(),
pipeline.Command(p),
pipelinerun.Command(p),
task.Command(p),
Expand Down

0 comments on commit c345fa9

Please sign in to comment.