Add zsh completion for 'docker system' subcommands

Signed-off-by: Steve Durrheimer <s.durrheimer@gmail.com>
This commit is contained in:
Steve Durrheimer 2016-10-30 22:46:21 +01:00 committed by Tibor Vass
parent fdfcbe778a
commit 9af599ffc5
1 changed files with 74 additions and 12 deletions

View File

@ -1825,6 +1825,56 @@ __docker_swarm_subcommand() {
# EO swarm
# BO system
__docker_system_commands() {
local -a _docker_system_subcommands
_docker_system_subcommands=(
"df:Show docker disk usage"
"events:Get real time events from the server"
"info:Display system-wide information"
"prune:Remove unused data"
)
_describe -t docker-system-commands "docker system command" _docker_system_subcommands
}
__docker_system_subcommand() {
local -a _command_args opts_help
local expl help="--help"
integer ret=1
opts_help=("(: -)--help[Print usage]")
case "$words[1]" in
(df)
# @TODO
;;
(events)
_arguments $(__docker_arguments) \
$opts_help \
"($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_events_filter" \
"($help)--since=[Events created since this timestamp]:timestamp: " \
"($help)--until=[Events created until this timestamp]:timestamp: " \
"($help)--format=[Format the output using the given go template]:template: " && ret=0
;;
(info)
_arguments $(__docker_arguments) \
$opts_help \
"($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " && ret=0
;;
(prune)
# @TODO
;;
(help)
_arguments $(__docker_arguments) ":subcommand:__docker_volume_commands" && ret=0
;;
esac
return ret
}
# EO system
# BO volume
__docker_volume_complete_ls_filters() {
@ -2093,13 +2143,8 @@ __docker_subcommand() {
;;
esac
;;
(events)
_arguments $(__docker_arguments) \
$opts_help \
"($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_events_filter" \
"($help)--since=[Events created since this timestamp]:timestamp: " \
"($help)--until=[Events created until this timestamp]:timestamp: " \
"($help)--format=[Format the output using the given go template]:template: " && ret=0
(events|info)
__docker_system_subcommand && ret=0
;;
(image)
local curcontext="$curcontext" state
@ -2122,11 +2167,6 @@ __docker_subcommand() {
words[1]='ls'
__docker_image_subcommand && ret=0
;;
(info|version)
_arguments $(__docker_arguments) \
$opts_help \
"($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " && ret=0
;;
(inspect)
local state
_arguments $(__docker_arguments) \
@ -2267,6 +2307,28 @@ __docker_subcommand() {
;;
esac
;;
(system)
local curcontext="$curcontext" state
_arguments $(__docker_arguments) \
$opts_help \
"($help -): :->command" \
"($help -)*:: :->option-or-argument" && ret=0
case $state in
(command)
__docker_system_commands && ret=0
;;
(option-or-argument)
curcontext=${curcontext%:*:*}:docker-${words[-1]}:
__docker_system_subcommand && ret=0
;;
esac
;;
(version)
_arguments $(__docker_arguments) \
$opts_help \
"($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " && ret=0
;;
(volume)
local curcontext="$curcontext" state
_arguments $(__docker_arguments) \