mac上配置docker-machine 命令自动补全

2018-03-23  本文已影响0人  偷得浮生半日咸

1. brew 安装bash-completion

brew install bash-completion
安装成功后根据提示在 ~/.bash_profilez文件中添加如下内容:
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
执行source ~/.bash_profile 使生效

2. 从github下载文件到本地

https://github.com/docker/machine/tree/master/contrib/completion/bash目录下的三个文件(docker-machine-prompt.bash,docker-machine-wrapper.bash,docker-machine.bash)下载到 /usr/local/etc/bash_completion.d/ 目录下

3. 在~/.bash_profile文件中追加如下内容:

source '/usr/local/etc/bash_completion.d/docker-machine-prompt.bash'        
source '/usr/local/etc/bash_completion.d/docker-machine-wrapper.bash'
source '/usr/local/etc/bash_completion.d/docker-machine.bash'
PS1='[\u@\h \W$(__docker_machine_ps1)]\$ '

执行source ~/.bash——profile 使生效

4. 重启终端

上一篇下一篇

猜你喜欢

热点阅读