From 9e452732374e8de0a450943c9433ca7df6a5635d Mon Sep 17 00:00:00 2001 From: Michael Maximilien Date: Thu, 10 Oct 2019 15:20:38 -0700 Subject: [PATCH] removes zsh completion since it does not work (fixes #426) --- pkg/kn/commands/completion.go | 21 ++++----------------- pkg/kn/commands/completion_test.go | 11 +---------- 2 files changed, 5 insertions(+), 27 deletions(-) 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) != "") - }) }