From 7e22719090bf33012c5cd327cc70ebd965cd923f Mon Sep 17 00:00:00 2001 From: Harald Albers Date: Wed, 26 Aug 2015 17:48:51 +0200 Subject: [PATCH 1/3] Fix suppressed blank in completion of `scale --help` Wrong placement of `compopt -o` introduces an unexpected behavior that did not matter as long as --help was the only option (you would probably not continue to type after --help): completion of options would not automatically append a whitespace character as expected. For the outstanding addition of the --timeout option, which has an argument, this would mean that the user would have to type an extra whitespace after completion of --timeout before the argument could be added. Signed-off-by: Harald Albers --- contrib/completion/bash/docker-compose | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/contrib/completion/bash/docker-compose b/contrib/completion/bash/docker-compose index 5692f0e4b..ee810ffae 100644 --- a/contrib/completion/bash/docker-compose +++ b/contrib/completion/bash/docker-compose @@ -278,10 +278,7 @@ _docker_compose_scale() { case "$prev" in =) COMPREPLY=("$cur") - ;; - *) - COMPREPLY=( $(compgen -S "=" -W "$(___docker_compose_all_services_in_compose_file)" -- "$cur") ) - compopt -o nospace + return ;; esac @@ -289,6 +286,10 @@ _docker_compose_scale() { -*) COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) ;; + *) + COMPREPLY=( $(compgen -S "=" -W "$(___docker_compose_all_services_in_compose_file)" -- "$cur") ) + compopt -o nospace + ;; esac } From b03a2f79104e098a9e9a01f7fcb9e8da7e6c4ec4 Mon Sep 17 00:00:00 2001 From: Harald Albers Date: Wed, 26 Aug 2015 17:57:04 +0200 Subject: [PATCH 2/3] Add completion for `scale --timeout` Signed-off-by: Harald Albers --- contrib/completion/bash/docker-compose | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contrib/completion/bash/docker-compose b/contrib/completion/bash/docker-compose index ee810ffae..71745d827 100644 --- a/contrib/completion/bash/docker-compose +++ b/contrib/completion/bash/docker-compose @@ -280,11 +280,14 @@ _docker_compose_scale() { COMPREPLY=("$cur") return ;; + --timeout|-t) + return + ;; esac case "$cur" in -*) - COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + COMPREPLY=( $( compgen -W "--help --timeout -t" -- "$cur" ) ) ;; *) COMPREPLY=( $(compgen -S "=" -W "$(___docker_compose_all_services_in_compose_file)" -- "$cur") ) From 2cfda01ff4562304d646b10c9069683bda774e33 Mon Sep 17 00:00:00 2001 From: Harald Albers Date: Wed, 26 Aug 2015 18:16:36 +0200 Subject: [PATCH 3/3] Use consistent argument order in bash completion In most of this file and in Dockers's bash completion the sort order of options is to sort alphabetically by long option name. The short options are put right behind their long couterpart. This commit improves consistency. Signed-off-by: Harald Albers --- contrib/completion/bash/docker-compose | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/contrib/completion/bash/docker-compose b/contrib/completion/bash/docker-compose index 71745d827..fe46a334e 100644 --- a/contrib/completion/bash/docker-compose +++ b/contrib/completion/bash/docker-compose @@ -223,7 +223,7 @@ _docker_compose_pull() { _docker_compose_restart() { case "$prev" in - -t | --timeout) + --timeout|-t) return ;; esac @@ -311,7 +311,7 @@ _docker_compose_start() { _docker_compose_stop() { case "$prev" in - -t | --timeout) + --timeout|-t) return ;; esac @@ -341,7 +341,7 @@ _docker_compose_unpause() { _docker_compose_up() { case "$prev" in - -t | --timeout) + --timeout|-t) return ;; esac @@ -402,11 +402,11 @@ _docker_compose() { local compose_file compose_project while [ $counter -lt $cword ]; do case "${words[$counter]}" in - -f|--file) + --file|-f) (( counter++ )) compose_file="${words[$counter]}" ;; - -p|--project-name) + --project-name|p) (( counter++ )) compose_project="${words[$counter]}" ;;