Merge pull request #1227 from pszczekutowicz/master

Added events filter scope for bash and zsh completion
This commit is contained in:
Sebastiaan van Stijn 2018-07-22 22:33:25 +02:00 committed by GitHub
commit 601131634e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -4658,6 +4658,10 @@ _docker_system_events() {
__docker_complete_networks --cur "${cur##*=}" __docker_complete_networks --cur "${cur##*=}"
return return
;; ;;
scope)
COMPREPLY=( $( compgen -W "local swarm" -- "${cur##*=}" ) )
return
;;
type) type)
COMPREPLY=( $( compgen -W "config container daemon image network plugin secret service volume" -- "${cur##*=}" ) ) COMPREPLY=( $( compgen -W "config container daemon image network plugin secret service volume" -- "${cur##*=}" ) )
return return
@ -4670,7 +4674,7 @@ _docker_system_events() {
case "$prev" in case "$prev" in
--filter|-f) --filter|-f)
COMPREPLY=( $( compgen -S = -W "container daemon event image label network type volume" -- "$cur" ) ) COMPREPLY=( $( compgen -S = -W "container daemon event image label network scope type volume" -- "$cur" ) )
__docker_nospace __docker_nospace
return return
;; ;;

View File

@ -431,7 +431,7 @@ __docker_complete_events_filter() {
integer ret=1 integer ret=1
declare -a opts declare -a opts
opts=('container' 'daemon' 'event' 'image' 'label' 'network' 'type' 'volume') opts=('container' 'daemon' 'event' 'image' 'label' 'network' 'scope' 'type' 'volume')
if compset -P '*='; then if compset -P '*='; then
case "${${words[-1]%=*}#*=}" in case "${${words[-1]%=*}#*=}" in
@ -461,6 +461,11 @@ __docker_complete_events_filter() {
(network) (network)
__docker_complete_networks && ret=0 __docker_complete_networks && ret=0
;; ;;
(scope)
local -a scope_opts
scope_opts=('local' 'swarm')
_describe -t scope-filter-opts "scope filter options" scope_opts && ret=0
;;
(type) (type)
local -a type_opts local -a type_opts
type_opts=('container' 'daemon' 'image' 'network' 'volume') type_opts=('container' 'daemon' 'image' 'network' 'volume')