From bdf88a6e676e719a3de2e0bf32739cee752d319c Mon Sep 17 00:00:00 2001 From: Harald Albers Date: Fri, 27 Jan 2017 18:20:01 +0100 Subject: [PATCH] Add bash completion for `docker service logs` Signed-off-by: Harald Albers --- contrib/completion/bash/docker | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/contrib/completion/bash/docker b/contrib/completion/bash/docker index e6fca33862..08eb8c6cb3 100644 --- a/contrib/completion/bash/docker +++ b/contrib/completion/bash/docker @@ -2662,6 +2662,8 @@ _docker_service() { ps update " + __docker_daemon_is_experimental && subcommands+="logs" + __docker_subcommands "$subcommands" && return case "$cur" in @@ -2694,6 +2696,26 @@ _docker_service_inspect() { esac } +_docker_service_logs() { + case "$prev" in + --since|--tail) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--details --follow -f --help --no-resolve --since --tail --timestamps -t" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag '--since|--tail') + if [ $cword -eq $counter ]; then + __docker_complete_services + fi + ;; + esac +} + _docker_service_list() { _docker_service_ls }