From e3544b2e99c0de2060352c660c0d357a0eca4ad1 Mon Sep 17 00:00:00 2001 From: Harald Albers Date: Sun, 20 Jan 2019 22:46:24 +0100 Subject: [PATCH] Add bash completion for `docker engine` command family Signed-off-by: Harald Albers --- contrib/completion/bash/docker | 63 ++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/contrib/completion/bash/docker b/contrib/completion/bash/docker index 99332430ce..5dd75f44e5 100644 --- a/contrib/completion/bash/docker +++ b/contrib/completion/bash/docker @@ -2716,6 +2716,68 @@ _docker_diff() { _docker_container_diff } + +_docker_engine() { + local subcommands=" + activate + check + update + " + __docker_subcommands "$subcommands" && return + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) ) + ;; + esac +} + +_docker_engine_activate() { + case "$prev" in + --containerd|--engine-image|--format|--license|--registry-prefix|--version) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--containerd --display-only --engine-image --format --help --license --quiet --registry-prefix --version" -- "$cur" ) ) + ;; + esac +} + +_docker_engine_check() { + case "$prev" in + --containerd|--engine-image|--format|--registry-prefix) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--containerd --downgrades --engine-image --format --help --pre-releases --quiet -q --registry-prefix --upgrades" -- "$cur" ) ) + ;; + esac +} + +_docker_engine_update() { + case "$prev" in + --containerd|--engine-image|--registry-prefix|--version) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--containerd --engine-image --help --registry-prefix --version" -- "$cur" ) ) + ;; + esac +} + + _docker_events() { _docker_system_events } @@ -5394,6 +5456,7 @@ _docker() { config container context + engine image network node