kubectl: fix hard-coded value in zsh completion

This commit is contained in:
Paul Barfuss
2021-12-07 15:13:39 -05:00
parent 0153febd9f
commit 339c361ca0

View File

@@ -17,6 +17,7 @@ limitations under the License.
package completion
import (
"fmt"
"io"
"github.com/spf13/cobra"
@@ -170,7 +171,8 @@ func runCompletionBash(out io.Writer, boilerPlate string, kubectl *cobra.Command
}
func runCompletionZsh(out io.Writer, boilerPlate string, kubectl *cobra.Command) error {
zshHead := "#compdef kubectl\ncompdef _kubectl kubectl\n"
commandName := kubectl.Name()
zshHead := fmt.Sprintf("#compdef %[1]s\ncompdef _%[1]s %[1]s\n", commandName)
out.Write([]byte(zshHead))
if len(boilerPlate) == 0 {