Skip to content

Commit 9b8e3ed

Browse files
authored
Merge pull request #4015 from jat001/patch-1
```#compdef``` must be the first line
2 parents b189947 + f64b343 commit 9b8e3ed

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

cmd/minikube/cmd/completion.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,10 @@ func GenerateBashCompletion(w io.Writer, cmd *cobra.Command) error {
105105

106106
// GenerateZshCompletion generates the completion for the zsh shell
107107
func GenerateZshCompletion(out io.Writer, cmd *cobra.Command) error {
108-
zshInitialization := `#compdef minikube
108+
zshAutoloadTag := `#compdef minikube
109+
`
109110

111+
zshInitialization := `
110112
__minikube_bash_source() {
111113
alias shopt=':'
112114
alias _expand=_bash_expand
@@ -239,7 +241,12 @@ __minikube_convert_bash_to_zsh() {
239241
<<'BASH_COMPLETION_EOF'
240242
`
241243

242-
_, err := out.Write([]byte(boilerPlate))
244+
_, err := out.Write([]byte(zshAutoloadTag))
245+
if err != nil {
246+
return err
247+
}
248+
249+
_, err = out.Write([]byte(boilerPlate))
243250
if err != nil {
244251
return err
245252
}

0 commit comments

Comments
 (0)