Add timeout flag to stop, restart, and up

The commands `stop`, `restart`, and `up` now support a flag `--timeout`.
It represents the number of seconds to give the services to comply to
the command. In case of `up`, this is only relevant if running in
attached mode.

Signed-off-by: Paul Horn <knutwalker@gmail.com>
This commit is contained in:
Paul Horn 2015-01-21 00:22:30 +01:00
commit 2534a0964f
2 changed files with 68 additions and 19 deletions

View file

@ -1,7 +1,7 @@
#!bash
#
# bash completion for docker-compose
#
#
# This work is based on the completion for the docker command.
#
# This script provides completion of:
@ -196,7 +196,20 @@ _docker-compose_pull() {
_docker-compose_restart() {
__docker-compose_services_running
case "$prev" in
-t | --timeout)
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "-t --timeout" -- "$cur" ) )
;;
*)
__docker-compose_services_running
;;
esac
}
@ -221,7 +234,7 @@ _docker-compose_run() {
;;
--entrypoint)
return
;;
;;
esac
case "$cur" in
@ -254,14 +267,33 @@ _docker-compose_start() {
_docker-compose_stop() {
__docker-compose_services_running
case "$prev" in
-t | --timeout)
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "-t --timeout" -- "$cur" ) )
;;
*)
__docker-compose_services_running
;;
esac
}
_docker-compose_up() {
case "$prev" in
-t | --timeout)
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--allow-insecure-ssl -d --no-build --no-color --no-deps --no-recreate" -- "$cur" ) )
COMPREPLY=( $( compgen -W "--allow-insecure-ssl -d --no-build --no-color --no-deps --no-recreate -t --timeout" -- "$cur" ) )
;;
*)
__docker-compose_services_all