找不到命令:__start_kubectl

问题描述 投票:0回答:3

我安装了 kubectl 并尝试为 zsh 启用 shell 自动完成功能。 当我使用

kubectl
自动补全效果很好。然而,当我尝试使用带有别名的自动完成功能时
k
然后 shell 返回我

k g...(eval):1: command not found: __start_kubectl                                                                                                                            8:45 
(eval):1: command not found: __start_kubectl
(eval):1: command not found: __start_kubectl

在我的

.zshrc
文件中,我有:

source <(kubectl completion zsh)
alias k=kubectl
compdef __start_kubectl k
kubernetes zsh kubectl zsh-completion
3个回答
1
投票

你能试试这个吗:

compdef _kubectl k

1
投票

将以下内容添加到 ~/.zshrc 文件的开头:

autoload -Uz compinit
compinit

然后重新启动您的终端。


0
投票

如果你使用 Oh My Zsh,对我来说修复它的是更新:

omz update

... lots of output

source ~/.zshrc
© www.soinside.com 2019 - 2024. All rights reserved.