开启 shell 自动补全
Kubebuilder 的 Bash 补全脚本可以通过命令 kubebuilder completion bash 来自动生成,Kubebuilder 的 Zsh 补全脚本可以通过命令 kubebuilder completion zsh 来自动生成。需要注意的是在你的 shell 环境中用 source 运行一下补全脚本就会开启 Kubebuilder 自动补全。
-
一旦安装完成,要在
/etc/shells中添加路径/usr/local/bin/bash。echo “/usr/local/bin/bash” > /etc/shells -
确保使用当前用户安装的 shell。
chsh -s /usr/local/bin/bash -
在 /.bash_profile 或 ~/.bashrc 中添加以下内容:
# kubebuilder autocompletion
if [ -f /usr/local/share/bash-completion/bash_completion ]; then
. /usr/local/share/bash-completion/bash_completion
fi
. <(kubebuilder completion)
- 重启终端以便让修改生效。
