What happened:
Running source <(kind completion zsh) fails with the following error
_arguments:comparguments:325: can only be called from completion function
_arguments:comparguments:325: can only be called from completion function
What you expected to happen:
The completions to import and be available
How to reproduce it (as minimally and precisely as possible):
Run source <(kind completion zsh) in zsh
Anything else we need to know?:
Environment:
kind version): 0.3.0-alphakubectl version): 1.14docker info): 18.09.2/etc/os-release): MacOS 10.14hmm, I wonder if this is a bug upstream in cobra, we are generating these with that library
https://github.com/spf13/cobra
/help
@BenTheElder:
This request has been marked as needing help from a contributor.
Please ensure the request meets the requirements listed here.
If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-help command.
In response to this:
/help
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
Might be related to https://github.com/spf13/cobra/pull/646
Did this work before? As afaik you don't source completions (as in bash) but instead add the folders containing them to fpath: https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org#telling-zsh-which-function-to-use-for-completing-a-command
e.g:
kind completion zsh > /somedir/_kind (once to generate it)
and in .zshrc
fpath=(/somedir $fpath)`
# and something like this (normally done by plugin managers - ideally only once for performance)
autoload -Uz compinit && \
compinit -C
馃憢
I added the autocompletion subcommand.
If you run kind completion
```
Outputs kind shell completion for the given shell (bash or zsh)
This depends on the bash-completion binary. Example installation instructions:
$ kind completion bash > ~/.kind-completion
$ source ~/.kind-completion
% kind completion zsh > /usr/local/share/zsh/site-functions/_kind
% autoload -U compinit && compinit
Additionally, you may want to output the completion to a file and source in your .bashrc
Note for zsh users: [1] zsh completions are only supported in versions of zsh >= 5.2
```
There's a PR in spf13/cobra https://github.com/spf13/cobra/pull/887 which lets you source autocompletion in zsh directly like bash but that hasn't been merged yet
Thanks @epk ! :-)
/assign
The upstream PR was closed.
I'm not a zsh user, but it looks like you should be using the instructions in kind completion rather than doing a source <(kind completion zsh).
ref: https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org#telling-zsh-which-function-to-use-for-completing-a-command
IMO it looks like we should probably encourage installing the completion script output instead, which kind completion currently does.
Most helpful comment
馃憢
I added the autocompletion subcommand.
If you run kind completion
```
Outputs kind shell completion for the given shell (bash or zsh)
This depends on the bash-completion binary. Example installation instructions:
for bash users
for zsh users
Additionally, you may want to output the completion to a file and source in your .bashrc
Note for zsh users: [1] zsh completions are only supported in versions of zsh >= 5.2
```
There's a PR in
spf13/cobrahttps://github.com/spf13/cobra/pull/887 which lets you source autocompletion in zsh directly like bash but that hasn't been merged yet