前提条件
己经安装了Homebrew
安装步骤
- 安装bash-completion包
#Install bash-comletion
brew install bash-completion #(new command)
brew tap homebrew/completions #(old command)
- 更新用户家目录下的
.bashrc
或.bash_profile
文件
#update .bashrc or .bash_profile
cat >> ~/.bashrc <<EOL
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
EOL
- 添加docker的补全脚本到
bash_completion
的脚本目录
#Add Docker-specific completions
cd /usr/local/etc/bash_completion.d
ln -s /Applications/Docker.app/Contents/Resources/etc/docker.bash-completion
ln -s /Applications/Docker.app/Contents/Resources/etc/docker-machine.bash-completion
ln -s /Applications/Docker.app/Contents/Resources/etc/docker-compose.bash-completion
*好了 可以享受你的Docker之旅了 _ *