diff --git a/compose/completion.md b/compose/completion.md index 91c8ba2cd4..d05b66ee0e 100644 --- a/compose/completion.md +++ b/compose/completion.md @@ -17,11 +17,12 @@ Make sure bash completion is installed. 1. On a current Linux OS (in a non-minimal installation), bash completion should be available. + 2. Place the completion script in `/etc/bash_completion.d/`. -```shell -sudo curl -L https://raw.githubusercontent.com/docker/compose/{{site.compose_version}}/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose -``` + ```shell + sudo curl -L https://raw.githubusercontent.com/docker/compose/{{site.compose_version}}/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose + ``` ### Mac @@ -32,17 +33,17 @@ sudo curl -L https://raw.githubusercontent.com/docker/compose/{{site.compose_ver For example, when running this command on Mac 10.13.2, place the completion script in `/usr/local/etc/bash_completion.d/`. -```shell -sudo curl -L https://raw.githubusercontent.com/docker/compose/{{site.compose_version}}/contrib/completion/bash/docker-compose -o /usr/local/etc/bash_completion.d/docker-compose -``` + ```shell + sudo curl -L https://raw.githubusercontent.com/docker/compose/{{site.compose_version}}/contrib/completion/bash/docker-compose -o /usr/local/etc/bash_completion.d/docker-compose + ``` 3. Add the following to your `~/.bash_profile`: -```shell -if [ -f $(brew --prefix)/etc/bash_completion ]; then + ```shell + if [ -f $(brew --prefix)/etc/bash_completion ]; then . $(brew --prefix)/etc/bash_completion -fi -``` + fi + ``` 4. You can source your `~/.bash_profile` or launch a new terminal to utilize completion. @@ -50,13 +51,14 @@ completion. ##### Install via MacPorts 1. Run `sudo port install bash-completion` to install bash completion. + 2. Add the following lines to `~/.bash_profile`: -```shell -if [ -f /opt/local/etc/profile.d/bash_completion.sh ]; then + ```shell + if [ -f /opt/local/etc/profile.d/bash_completion.sh ]; then . /opt/local/etc/profile.d/bash_completion.sh -fi -``` + fi + ``` 3. You can source your `~/.bash_profile` or launch a new terminal to utilize completion. @@ -72,34 +74,34 @@ Add `docker` and `docker-compose` to the plugins list in `~/.zshrc` to run autoc ```shell plugins=(... docker docker-compose ) -``` + ``` #### Without oh-my-zsh shell 1. Place the completion script in your `/path/to/zsh/completion` (typically `~/.zsh/completion/`): -```shell -$ mkdir -p ~/.zsh/completion -$ curl -L https://raw.githubusercontent.com/docker/compose/{{site.compose_version}}/contrib/completion/zsh/_docker-compose > ~/.zsh/completion/_docker-compose -``` + ```shell + $ mkdir -p ~/.zsh/completion + $ curl -L https://raw.githubusercontent.com/docker/compose/{{site.compose_version}}/contrib/completion/zsh/_docker-compose > ~/.zsh/completion/_docker-compose + ``` 2. Include the directory in your `$fpath` by adding in `~/.zshrc`: -```shell -fpath=(~/.zsh/completion $fpath) -``` + ```shell + fpath=(~/.zsh/completion $fpath) + ``` 3. Make sure `compinit` is loaded or do it by adding in `~/.zshrc`: -```shell -autoload -Uz compinit && compinit -i -``` + ```shell + autoload -Uz compinit && compinit -i + ``` 4. Then reload your shell: -```shell -exec $SHELL -l -``` + ```shell + exec $SHELL -l + ``` ## Available completions