kubecolor icon indicating copy to clipboard operation
kubecolor copied to clipboard

After entering kubectl - N and adding tab, the following syntax error will appear

Open jjy7pspsjl opened this issue 3 years ago • 5 comments

K8s version: v1.23.7 Kubecolor version: 0.0.20

Fault description: After entering kubectl - N and adding tab, the following syntax error will appear

image

jjy7pspsjl avatar Aug 11 '22 02:08 jjy7pspsjl

image

No problem with other uses

jjy7pspsjl avatar Aug 11 '22 02:08 jjy7pspsjl

I believe its related to having kubectl autocomplete enabled and there are a few other reports with the same issue so this is likely a duplicate of #78

If the following line is in your ~/.bashrc (or appropriate shell initialization script for your environment ~/.bash_profile ) commenting it out will stop the autocomplete from working and prevent the error.

# source <(kubectl completion bash)

Take a look at the README.md section on configuring autocompletion for kubecolor if this is the issue.

Putting the following into my ~/.bashrc solved the issue for me

alias kubectl='kubecolor'
source <(kubectl completion bash)
complete -o nospace -F __start_kubectl kubectl

dstuartkelly avatar Aug 24 '22 09:08 dstuartkelly

This is fixed in the new clone of the project. Get it at https://github.com/kubecolor/kubecolor or brew install kubecolor/tap/kubecolor

prune998 avatar Sep 29 '22 01:09 prune998

First of all, thank you for your reply. I just tested and failed. The same error is reported.

------------------ 原始邮件 ------------------ 发件人: "hidetatz/kubecolor" @.>; 发送时间: 2022年8月24日(星期三) 下午5:27 @.>; @.@.>; 主题: Re: [hidetatz/kubecolor] After entering kubectl - N and adding tab, the following syntax error will appear (Issue #107)

I believe its related to having kubectl autocomplete enabled and there are a few other reports with the same issue so this is likely a duplicate? If the following line is in you ~/.bashrc (or appropriate shell initialization script for your environment ~/.zshrc ~/.bash_profile ) commenting it out will stop the autocomplete from working and prevent the error.

source <(kubectl completion bash)

Take a look at the README.md section on configuring autocompletion for kubecolor if this is the issue.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

jjy7pspsjl avatar Oct 11 '22 07:10 jjy7pspsjl

Can you please give the full output of:

  • k version (that should return the kubectl version)
  • k --kubecolor-version (that should return the kubecolor version)
  • alias | grep "k=
  • alias | grep "kubectl="
  • which kubectl
  • which kubecolor

Try to use kubectl version v1.25.2 or higher... I also had issue with some 1.23 versions.

kubecolor -n                                                                                                                                                                                                                                   
default                  istio-system              kube-public               opencost               kube-system               ops                       user-history-debugger

Also, please specify your OS version/distro. On Ubuntu, I'm using kubectl version v1.23.11 installed from gcloud without any problem.

Thanks

prune998 avatar Oct 11 '22 11:10 prune998