📌
kubectl, dockerコマンドの自動入力補完設定
前提条件
bash-completion
がインストールされていること
# For RHEL dists
yum install bash-completion
# For Debian dists
apt-get install bash-completion
kubectl
Reference: https://kubernetes.io/docs/tasks/tools/included/optional-kubectl-configs-bash-linux/
echo 'source <(kubectl completion bash)' >>~/.bashrc
source ~/.bashrc
docker
Reference: https://github.com/docker/cli/blob/master/contrib/completion/bash/docker
sudo curl https://raw.githubusercontent.com/docker/docker-ce/master/components/cli/contrib/completion/bash/docker \
-o /etc/bash_completion.d/docker.sh
その後一旦ログアウトし、再ログインすれば補完が有効になる
Discussion