首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >Mac zsh kubectl 安装及自动补全配置

Mac zsh kubectl 安装及自动补全配置

作者头像
全栈程序员站长
发布2021-05-19 15:56:53
发布2021-05-19 15:56:53
1.9K0
举报

安装

代码语言:javascript
复制
brew install kubectl 

配置自动补全 The kubectl completion script for Zsh can be generated with the command kubectl completion zsh. Sourcing the completion script in your shell enables kubectl autocompletion. To do so in all your shell sessions, add the following to your ~/.zshrc file:

代码语言:javascript
复制
source <(kubectl completion zsh)

If you have an alias for kubectl, you can extend shell completion to work with that alias:

代码语言:javascript
复制
echo 'alias k=kubectl' >>~/.zshrc
echo 'complete -F __start_kubectl k' >>~/.zshrc

After reloading your shell, kubectl autocompletion should be working. If you get an error like complete:13: command not found: compdef, then add the following to the beginning of your ~/.zshrc file:

代码语言:javascript
复制
autoload -Uz compinit
compinit

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/100386.html原文链接:

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档