Split shell completion section in Bash and Zsh (#5549)

This commit is contained in:
Alejandro Avilés 2017-12-19 00:38:32 +01:00 committed by Misty Stanley-Jones
parent 1ff98b6467
commit 47107d1986
1 changed files with 16 additions and 17 deletions

View File

@ -477,23 +477,19 @@ how to set the client TLS certificate for verification, see [Verify repository
client with certificates](/engine/security/certificates.md) in the Docker Engine client with certificates](/engine/security/certificates.md) in the Docker Engine
topics. topics.
## Install completion ## Install shell completion
If you are using [bash Docker for Mac comes with scripts to enable completion for the `docker`,
completion](https://www.debian-administration.org/article/316/An_introduction_to_bash_completion_part_1), `docker-machine`, and `docker-compose` commands. The completion scripts may be
such as [homebrew bash-completion on found inside `Docker.app`, in the `Contents/Resources/etc/` directory and can be
Mac](http://davidalger.com/development/bash-completion-on-os-x-with-brew/), or installed both in Bash and Zsh.
the [zsh completion system](http://zsh.sourceforge.net/Doc/Release/Completion-System.html)
completion scripts for the following commands may be found inside `Docker.app`,
in the `Contents/Resources/etc/` directory:
- docker ### Bash
- docker-machine
- docker-compose
To activate bash completion, these files need to be copied or symlinked to your Bash has [built-in support for completion](https://www.debian-administration.org/article/316/An_introduction_to_bash_completion_part_1)
`bash_completion.d/` directory. For example, if you installed bash via To activate completion for Docker commands, these files need to be copied or
[Homebrew](http://brew.sh/): symlinked to your `bash_completion.d/` directory. For example, if you installed
bash via [Homebrew](http://brew.sh/):
```bash ```bash
ln -s /Applications/Docker.app/Contents/Resources/etc/docker.bash-completion /usr/local/etc/bash_completion.d/docker ln -s /Applications/Docker.app/Contents/Resources/etc/docker.bash-completion /usr/local/etc/bash_completion.d/docker
@ -501,9 +497,12 @@ ln -s /Applications/Docker.app/Contents/Resources/etc/docker-machine.bash-comple
ln -s /Applications/Docker.app/Contents/Resources/etc/docker-compose.bash-completion /usr/local/etc/bash_completion.d/docker-compose ln -s /Applications/Docker.app/Contents/Resources/etc/docker-compose.bash-completion /usr/local/etc/bash_completion.d/docker-compose
``` ```
To activate zsh completion, these files need to be copied or symlinked to your ### Zsh
zsh `site-functions/` directory. For example, if you installed zsh via
[Homebrew](http://brew.sh/): In Zsh, the [completion system](http://zsh.sourceforge.net/Doc/Release/Completion-System.html)
takes care of things. To activate completion for Docker commands, these files
need to be copied or symlinked to your Zsh `site-functions/` directory. For
example, if you installed Zsh via [Homebrew](http://brew.sh/):
```bash ```bash
ln -s /Applications/Docker.app/Contents/Resources/etc/docker.zsh-completion /usr/local/share/zsh/site-functions/_docker ln -s /Applications/Docker.app/Contents/Resources/etc/docker.zsh-completion /usr/local/share/zsh/site-functions/_docker