diff --git a/pkg/kn/commands/completion.go b/pkg/kn/commands/completion.go index 365a5814e9..0d64452cba 100644 --- a/pkg/kn/commands/completion.go +++ b/pkg/kn/commands/completion.go @@ -20,26 +20,13 @@ import ( "github.com/spf13/cobra" ) -type CompletionFlags struct { - Zsh bool -} - func NewCompletionCommand(p *KnParams) *cobra.Command { - var completionFlags CompletionFlags - - completionCmd := &cobra.Command{ + return &cobra.Command{ Use: "completion", - Short: "Output shell completion code (default Bash)", - Hidden: true, // Don't show this in help listing. + Short: "Output shell completion code (Bash)", + Hidden: true, // Don't show this in help listing Run: func(cmd *cobra.Command, args []string) { - if completionFlags.Zsh { - cmd.Root().GenZshCompletion(os.Stdout) - } else { - cmd.Root().GenBashCompletion(os.Stdout) - } + cmd.Root().GenBashCompletion(os.Stdout) }, } - - completionCmd.Flags().BoolVar(&completionFlags.Zsh, "zsh", false, "Generates completion code for Zsh shell.") - return completionCmd } diff --git a/pkg/kn/commands/completion_test.go b/pkg/kn/commands/completion_test.go index f108c74220..7aa3585d55 100644 --- a/pkg/kn/commands/completion_test.go +++ b/pkg/kn/commands/completion_test.go @@ -38,7 +38,7 @@ func TestCompletion(t *testing.T) { t.Run("creates a CompletionCommand", func(t *testing.T) { setup() assert.Equal(t, completionCmd.Use, "completion") - assert.Equal(t, completionCmd.Short, "Output shell completion code (default Bash)") + assert.Equal(t, completionCmd.Short, "Output shell completion code (Bash)") assert.Assert(t, completionCmd.RunE == nil) }) @@ -50,13 +50,4 @@ func TestCompletion(t *testing.T) { completionCmd.Run(fakeRootCmd, []string{}) assert.Assert(t, ReadStdout(t) != "") }) - - t.Run("returns completion code for ZSH", func(t *testing.T) { - setup() - CaptureStdout(t) - defer ReleaseStdout(t) - - completionCmd.Run(fakeRootCmd, []string{"--zsh"}) - assert.Assert(t, ReadStdout(t) != "") - }) }