From f64b343965798fccadba3f9a3172912d4a13e1ca Mon Sep 17 00:00:00 2001 From: Jat Date: Thu, 28 Mar 2019 10:44:32 +0800 Subject: [PATCH] ```#compdef``` must be the first line --- cmd/minikube/cmd/completion.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cmd/minikube/cmd/completion.go b/cmd/minikube/cmd/completion.go index 7de31f908697..eb697b88342a 100644 --- a/cmd/minikube/cmd/completion.go +++ b/cmd/minikube/cmd/completion.go @@ -105,8 +105,10 @@ func GenerateBashCompletion(w io.Writer, cmd *cobra.Command) error { // GenerateZshCompletion generates the completion for the zsh shell func GenerateZshCompletion(out io.Writer, cmd *cobra.Command) error { - zshInitialization := `#compdef minikube + zshAutoloadTag := `#compdef minikube +` + zshInitialization := ` __minikube_bash_source() { alias shopt=':' alias _expand=_bash_expand @@ -239,7 +241,12 @@ __minikube_convert_bash_to_zsh() { <<'BASH_COMPLETION_EOF' ` - _, err := out.Write([]byte(boilerPlate)) + _, err := out.Write([]byte(zshAutoloadTag)) + if err != nil { + return err + } + + _, err = out.Write([]byte(boilerPlate)) if err != nil { return err }