-
-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] Cannot complete commands with kubectl kc
#786
Comments
@nekomeowww Thanks for the feedback. This is a known issue, in fact, auto-completion does not work when kubecm is run as a |
Oh, ok. Thanks for replying! I never heard of this limitation, I might have to take a look at Is that ok if I create a documentation update Pull Request and state out the limitations of |
Absolutely! Thank you for your contribution! |
FYI, it looks like the completion is currently supported for plugins of However I haven't figure out how to use the documented way of this Pull Request to make the completion possible for |
Thank you very much! Looks like I'm out of date. |
Since this plugin uses Cobra, making shell completion work is very easy.
Now put the above file somewhere on your @sunny0826 You could provide this file in your repo and provide instructions telling users to install it on @nekomeowww Until this is available you can use this project to automatically make such completions work for any kubectl plugin that uses the https://github.com/spf13/cobra project I just used it with |
@marckhouzam Thank you so much ! |
Thanks for replying and participating this issue! @marckhouzam
I've tried either your plugin For the manual, and direct shell, the completion file contains the following content: #!/usr/bin/env zsh
# Call the __complete command passing it all arguments
kubectl kc __complete "\$@" However, it would produce the following error when trying to use TAB to request the completion: ❯ kubectl kc (eval):1: command not found: _kubectl
(eval):1: command not found: _kubectl If I try to execute the so do "proxy" completion shell directly, I get the prompt to say the completion ended:
So how does your |
There should not be a
Not sure about the above. Let's see if the other comments get rid of it.
Try Assuming you have shell completion working for kubectl this is what I did.
|
Thanks for pointing out these incorrect setup for me. I didn't find out these mistakes before. And I can get
working right now. However, both
My
which should be compatible with the feature you added. And indeed my completion for |
Ok I've located the root cause. Such issue consists two major cause:
I have gathered my needed blocks to test and contribute to Again, thanks for debugging and providing me such details @marckhouzam , much appreciated. |
Describe the bug
Cannot complete commands with
kubectl kc
.How to reproduce issues
Cannot complete commands with
kubectl kc
Steps to reproduce the behavior:
kubecm
withkubectl krew install kc
echo "autoload -U compinit; compinit" >> ~/.zshrc
kubectl kc completion zsh > "${fpath[1]}/_kubecm"
kubectl kc list
lists all the contexts, got the following outputs:kubectl kc switch
and then tab, got the following outputs:Expected behavior
Should prompt sub-commands and its all descriptions.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: