Add --help to subcommands in zsh completion

Signed-off-by: Steve Durrheimer <s.durrheimer@gmail.com>
This commit is contained in:
Steve Durrheimer 2015-06-26 09:00:47 +02:00
parent 8346186469
commit 745e838673
1 changed files with 19 additions and 3 deletions

View File

@ -162,6 +162,7 @@ __docker-compose_subcommand () {
case "$words[1]" in case "$words[1]" in
(build) (build)
_arguments \ _arguments \
'--help[Print usage]' \
'--no-cache[Do not use cache when building the image]' \ '--no-cache[Do not use cache when building the image]' \
'*:services:__docker-compose_services_from_build' && ret=0 '*:services:__docker-compose_services_from_build' && ret=0
;; ;;
@ -170,20 +171,24 @@ __docker-compose_subcommand () {
;; ;;
(kill) (kill)
_arguments \ _arguments \
'--help[Print usage]' \
'-s[SIGNAL to send to the container. Default signal is SIGKILL.]:signal:_signals' \ '-s[SIGNAL to send to the container. Default signal is SIGKILL.]:signal:_signals' \
'*:running services:__docker-compose_runningservices' && ret=0 '*:running services:__docker-compose_runningservices' && ret=0
;; ;;
(logs) (logs)
_arguments \ _arguments \
'--help[Print usage]' \
'--no-color[Produce monochrome output.]' \ '--no-color[Produce monochrome output.]' \
'*:services:__docker-compose_services_all' && ret=0 '*:services:__docker-compose_services_all' && ret=0
;; ;;
(migrate-to-labels) (migrate-to-labels)
_arguments \ _arguments -A '-*' \
'--help[Print usage]' \
'(-):Recreate containers to add labels' && ret=0 '(-):Recreate containers to add labels' && ret=0
;; ;;
(port) (port)
_arguments \ _arguments \
'--help[Print usage]' \
'--protocol=-[tcp or udap (defaults to tcp)]:protocol:(tcp udp)' \ '--protocol=-[tcp or udap (defaults to tcp)]:protocol:(tcp udp)' \
'--index=-[index of the container if there are mutiple instances of a service (defaults to 1)]:index: ' \ '--index=-[index of the container if there are mutiple instances of a service (defaults to 1)]:index: ' \
'1:running services:__docker-compose_runningservices' \ '1:running services:__docker-compose_runningservices' \
@ -191,17 +196,20 @@ __docker-compose_subcommand () {
;; ;;
(ps) (ps)
_arguments \ _arguments \
'--help[Print usage]' \
'-q[Only display IDs]' \ '-q[Only display IDs]' \
'*:services:__docker-compose_services_all' && ret=0 '*:services:__docker-compose_services_all' && ret=0
;; ;;
(pull) (pull)
_arguments \ _arguments \
'--allow-insecure-ssl[Allow insecure connections to the docker registry]' \ '--allow-insecure-ssl[Allow insecure connections to the docker registry]' \
'--help[Print usage]' \
'*:services:__docker-compose_services_from_image' && ret=0 '*:services:__docker-compose_services_from_image' && ret=0
;; ;;
(rm) (rm)
_arguments \ _arguments \
'(-f --force)'{-f,--force}"[Don't ask to confirm removal]" \ '(-f --force)'{-f,--force}"[Don't ask to confirm removal]" \
'--help[Print usage]' \
'-v[Remove volumes associated with containers]' \ '-v[Remove volumes associated with containers]' \
'*:stopped services:__docker-compose_stoppedservices' && ret=0 '*:stopped services:__docker-compose_stoppedservices' && ret=0
;; ;;
@ -211,6 +219,7 @@ __docker-compose_subcommand () {
'-d[Detached mode: Run container in the background, print new container name.]' \ '-d[Detached mode: Run container in the background, print new container name.]' \
'--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \ '--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \
'*-e[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \ '*-e[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \
'--help[Print usage]' \
'(-u --user)'{-u,--user=-}'[Run as specified username or uid]:username or uid:_users' \ '(-u --user)'{-u,--user=-}'[Run as specified username or uid]:username or uid:_users' \
"--no-deps[Don't start linked services.]" \ "--no-deps[Don't start linked services.]" \
'--rm[Remove container after run. Ignored in detached mode.]' \ '--rm[Remove container after run. Ignored in detached mode.]' \
@ -221,13 +230,18 @@ __docker-compose_subcommand () {
'*::arguments: _normal' && ret=0 '*::arguments: _normal' && ret=0
;; ;;
(scale) (scale)
_arguments '*:running services:__docker-compose_runningservices' && ret=0 _arguments \
'--help[Print usage]' \
'*:running services:__docker-compose_runningservices' && ret=0
;; ;;
(start) (start)
_arguments '*:stopped services:__docker-compose_stoppedservices' && ret=0 _arguments \
'--help[Print usage]' \
'*:stopped services:__docker-compose_stoppedservices' && ret=0
;; ;;
(stop|restart) (stop|restart)
_arguments \ _arguments \
'--help[Print usage]' \
'(-t --timeout)'{-t,--timeout}"[Specify a shutdown timeout in seconds. (default: 10)]:seconds: " \ '(-t --timeout)'{-t,--timeout}"[Specify a shutdown timeout in seconds. (default: 10)]:seconds: " \
'*:running services:__docker-compose_runningservices' && ret=0 '*:running services:__docker-compose_runningservices' && ret=0
;; ;;
@ -235,6 +249,7 @@ __docker-compose_subcommand () {
_arguments \ _arguments \
'--allow-insecure-ssl[Allow insecure connections to the docker registry]' \ '--allow-insecure-ssl[Allow insecure connections to the docker registry]' \
'-d[Detached mode: Run containers in the background, print new container names.]' \ '-d[Detached mode: Run containers in the background, print new container names.]' \
'--help[Print usage]' \
'--no-color[Produce monochrome output.]' \ '--no-color[Produce monochrome output.]' \
"--no-deps[Don't start linked services.]" \ "--no-deps[Don't start linked services.]" \
"--no-recreate[If containers already exist, don't recreate them.]" \ "--no-recreate[If containers already exist, don't recreate them.]" \
@ -245,6 +260,7 @@ __docker-compose_subcommand () {
;; ;;
(version) (version)
_arguments \ _arguments \
'--help[Print usage]' \
"--short[Shows only Compose's version number.]" && ret=0 "--short[Shows only Compose's version number.]" && ret=0
;; ;;
(*) (*)