Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,22 @@ REMOTE_EXCLUDE=(ting styles advagg_*)
LOCAL_PATH='sites/default/files'
```

#### Completion
## Completions

To enable bash completion (tab commands).
### Bash

You can install completions for `bash` by running:

```sh
ln -s $(git rev-parse --show-toplevel)/completion/bash/itkdev-docker-compose-completion.bash $(brew --prefix)/etc/bash_completion.d/itkdev-docker-compose
```

### Zsh

You can install completions for `zsh` by updating `fpath` in `~/.zshrc`, e.g. by running:

```sh
ln -s $(git rev-parse --show-toplevel)/scripts/itkdev-docker-compose-completion.bash $(brew --prefix)/etc/bash_completion.d/itkdev-docker-compose
echo "fpath=($(git rev-parse --show-toplevel)/completion/zsh \$fpath) # itkdev-docker " >> ~/.zshrc
```

### Docker UI
Expand Down
70 changes: 70 additions & 0 deletions completion/zsh/_itkdev-docker-compose
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#compdef itkdev-docker-compose

# Description
# -----------
# zsh completion for itkdev-docker-compose
# -------------------------------------------------------------------------
# Authors
# -------
# * Mikkel Ricky <rimi@aarhus.dk>
# -------------------------------------------------------------------------
# Inspiration
# -----------
# * https://github.com/docker/compose/blob/master/contrib/completion/zsh/_docker-compose
# -------------------------------------------------------------------------

_itkdev-docker-compose() {
local curcontext="$curcontext" state line
integer ret=1
typeset -A opt_args

_arguments -C \
'--help[Get help]' \
'(-): :->command' \
'(-)*:: :->option-or-argument' \
&& ret=0

case $state in
(command)
_values 'itkdev-docker-compose command' \
'url[Print url to site.]' \
'open[Open url in default browser.]' \
'drush[Run drush command.]' \
'sync[Sync both database and files.]' \
'sync\:db[Sync database base.]' \
'sync\:files[Sync files base.]' \
'sql\:connect[Print mysql command for connecting to database.]' \
'sql\:port[Display the exposed MariaDB SQL server port.]' \
'mailhog\:url[URL for the mailhog web-interface.]' \
'mailhog\:open[Open mailhog url in default browser.]' \
'xdebug[Boot the containers with PHP xdebug support enabled.]' \
'hosts\:insert[Insert the docker site url into the hosts file.]' \
'images\:pull[Update/pull all docker images.]' \
'composer[Run composer command inside phpfpm container.]' \
&& ret=0

# 'bin'{bin/*,vendor/bin/*}'[Run command command inside phpfpm container]' \
# *[Pass command and arguments to `docker-compose` and
# hope for the best.
;;

# __itkdev-docker-compose_commands && ret=0
# ;;
# (option-or-argument)
# curcontext=${curcontext%:*:*}:docker-compose-$words[1]:
# __itkdev-docker-compose_subcommand && ret=0
# ;;
esac

return ret
}

_itkdev-docker-compose "$@"

# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et