mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-22 07:43:31 +01:00
feat(docker): update completion
Taken from 79dca7a38e/contrib/completion/zsh/_docker
Closes #10826
This commit is contained in:
parent
da7ea13ba9
commit
a4392cfc16
@ -567,7 +567,7 @@ __docker_container_commands() {
|
||||
"cp:Copy files/folders between a container and the local filesystem"
|
||||
"create:Create a new container"
|
||||
"diff:Inspect changes on a container's filesystem"
|
||||
"exec:Run a command in a running container"
|
||||
"exec:Execute a command in a running container"
|
||||
"export:Export a container's filesystem as a tar archive"
|
||||
"inspect:Display detailed information on one or more containers"
|
||||
"kill:Kill one or more running containers"
|
||||
@ -579,7 +579,7 @@ __docker_container_commands() {
|
||||
"rename:Rename a container"
|
||||
"restart:Restart one or more containers"
|
||||
"rm:Remove one or more containers"
|
||||
"run:Run a command in a new container"
|
||||
"run:Create and run a new container from an image"
|
||||
"start:Start one or more stopped containers"
|
||||
"stats:Display a live stream of container(s) resource usage statistics"
|
||||
"stop:Stop one or more running containers"
|
||||
@ -650,6 +650,7 @@ __docker_container_subcommand() {
|
||||
"($help)*"{-p=,--publish=}"[Expose a container's port to the host]:port:_ports"
|
||||
"($help)--pid=[PID namespace to use]:PID namespace:__docker_complete_pid"
|
||||
"($help)--privileged[Give extended privileges to this container]"
|
||||
"($help -q --quiet)"{-q,--quiet}"[Suppress the pull output]"
|
||||
"($help)--read-only[Mount the container's root filesystem as read only]"
|
||||
"($help)*--security-opt=[Security options]:security option: "
|
||||
"($help)*--shm-size=[Size of '/dev/shm' (format is '<number><unit>')]:shm size: "
|
||||
@ -802,7 +803,7 @@ __docker_container_subcommand() {
|
||||
"($help -a --all)"{-a,--all}"[Show all containers]" \
|
||||
"($help)--before=[Show only container created before...]:containers:__docker_complete_containers" \
|
||||
"($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_ps_filters" \
|
||||
"($help)--format=[Pretty-print containers using a Go template]:template: " \
|
||||
"($help)--format=[Format the output using the given Go template]:template: " \
|
||||
"($help -l --latest)"{-l,--latest}"[Show only the latest created container]" \
|
||||
"($help -n --last)"{-n=,--last=}"[Show n last created containers (includes all states)]:n:(1 5 10 25 50)" \
|
||||
"($help)--no-trunc[Do not truncate output]" \
|
||||
@ -907,7 +908,7 @@ __docker_container_subcommand() {
|
||||
_arguments $(__docker_arguments) \
|
||||
$opts_help \
|
||||
"($help -a --all)"{-a,--all}"[Show all containers (default shows just running)]" \
|
||||
"($help)--format=[Pretty-print images using a Go template]:template: " \
|
||||
"($help)--format=[Format the output using the given Go template]:template: " \
|
||||
"($help)--no-stream[Disable streaming stats and only pull the first result]" \
|
||||
"($help)--no-trunc[Do not truncate output]" \
|
||||
"($help -)*:containers:__docker_complete_running_containers" && ret=0
|
||||
@ -973,8 +974,8 @@ __docker_image_commands() {
|
||||
"load:Load an image from a tar archive or STDIN"
|
||||
"ls:List images"
|
||||
"prune:Remove unused images"
|
||||
"pull:Pull an image or a repository from a registry"
|
||||
"push:Push an image or a repository to a registry"
|
||||
"pull:Download an image from a registry"
|
||||
"push:Upload an image to a registry"
|
||||
"rm:Remove one or more images"
|
||||
"save:Save one or more images to a tar archive (streamed to STDOUT by default)"
|
||||
"tag:Tag an image into a repository"
|
||||
@ -1060,7 +1061,7 @@ __docker_image_subcommand() {
|
||||
"($help -a --all)"{-a,--all}"[Show all images]" \
|
||||
"($help)--digests[Show digests]" \
|
||||
"($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_images_filters" \
|
||||
"($help)--format=[Pretty-print images using a Go template]:template: " \
|
||||
"($help)--format=[Format the output using the given Go template]:template: " \
|
||||
"($help)--no-trunc[Do not truncate output]" \
|
||||
"($help -q --quiet)"{-q,--quiet}"[Only show image IDs]" \
|
||||
"($help -): :__docker_complete_repositories" && ret=0
|
||||
@ -1082,7 +1083,7 @@ __docker_image_subcommand() {
|
||||
(push)
|
||||
_arguments $(__docker_arguments) \
|
||||
$opts_help \
|
||||
"($help -a --all-tags)"{-a,--all-tags}"[Push all tagged images in the repository]" \
|
||||
"($help -a --all-tags)"{-a,--all-tags}"[Push all tags of an image to the repository]" \
|
||||
"($help)--disable-content-trust[Skip image signing]" \
|
||||
"($help -): :__docker_complete_images" && ret=0
|
||||
;;
|
||||
@ -1292,7 +1293,7 @@ __docker_network_subcommand() {
|
||||
$opts_help \
|
||||
"($help)--no-trunc[Do not truncate the output]" \
|
||||
"($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_network_complete_ls_filters" \
|
||||
"($help)--format=[Pretty-print networks using a Go template]:template: " \
|
||||
"($help)--format=[Format the output using the given Go template]:template: " \
|
||||
"($help -q --quiet)"{-q,--quiet}"[Only display network IDs]" && ret=0
|
||||
;;
|
||||
(prune)
|
||||
@ -2050,7 +2051,7 @@ __docker_service_subcommand() {
|
||||
_arguments $(__docker_arguments) \
|
||||
$opts_help \
|
||||
"($help)*"{-f=,--filter=}"[Filter output based on conditions provided]:filter:__docker_service_complete_ls_filters" \
|
||||
"($help)--format=[Pretty-print services using a Go template]:template: " \
|
||||
"($help)--format=[Format the output using the given Go template]:template: " \
|
||||
"($help -q --quiet)"{-q,--quiet}"[Only display IDs]" && ret=0
|
||||
;;
|
||||
(rm|remove)
|
||||
@ -2253,7 +2254,7 @@ __docker_stack_subcommand() {
|
||||
_arguments $(__docker_arguments) \
|
||||
$opts_help \
|
||||
"($help)*"{-f=,--filter=}"[Filter output based on conditions provided]:filter:__docker_stack_complete_services_filters" \
|
||||
"($help)--format=[Pretty-print services using a Go template]:template: " \
|
||||
"($help)--format=[Format the output using the given Go template]:template: " \
|
||||
"($help -q --quiet)"{-q,--quiet}"[Only display IDs]" \
|
||||
"($help -):stack:__docker_complete_stacks" && ret=0
|
||||
;;
|
||||
@ -2520,7 +2521,7 @@ __docker_volume_subcommand() {
|
||||
_arguments $(__docker_arguments) \
|
||||
$opts_help \
|
||||
"($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_volume_complete_ls_filters" \
|
||||
"($help)--format=[Pretty-print volumes using a Go template]:template: " \
|
||||
"($help)--format=[Format the output using the given Go template]:template: " \
|
||||
"($help -q --quiet)"{-q,--quiet}"[Only display volume names]" && ret=0
|
||||
;;
|
||||
(prune)
|
||||
@ -2582,10 +2583,8 @@ __docker_context_subcommand() {
|
||||
(create)
|
||||
_arguments $(__docker_arguments) \
|
||||
$opts_help \
|
||||
"($help)--default-stack-orchestrator=[Default orchestrator for stack operations to use with this context]:default-stack-orchestrator:(swarm kubernetes all)" \
|
||||
"($help)--description=[Description of the context]:description:" \
|
||||
"($help)--docker=[Set the docker endpoint]:docker:" \
|
||||
"($help)--kubernetes=[Set the kubernetes endpoint]:kubernetes:" \
|
||||
"($help)--from=[Create context from a named context]:from:__docker_complete_contexts" \
|
||||
"($help -):name: " && ret=0
|
||||
;;
|
||||
@ -2607,10 +2606,8 @@ __docker_context_subcommand() {
|
||||
(update)
|
||||
_arguments $(__docker_arguments) \
|
||||
$opts_help \
|
||||
"($help)--default-stack-orchestrator=[Default orchestrator for stack operations to use with this context]:default-stack-orchestrator:(swarm kubernetes all)" \
|
||||
"($help)--description=[Description of the context]:description:" \
|
||||
"($help)--docker=[Set the docker endpoint]:docker:" \
|
||||
"($help)--kubernetes=[Set the kubernetes endpoint]:kubernetes:" \
|
||||
"($help -):name:" && ret=0
|
||||
;;
|
||||
esac
|
||||
@ -2734,9 +2731,6 @@ __docker_subcommand() {
|
||||
"($help -b --bridge)"{-b=,--bridge=}"[Attach containers to a network bridge]:bridge:_net_interfaces" \
|
||||
"($help)--bip=[Network bridge IP]:IP address: " \
|
||||
"($help)--cgroup-parent=[Parent cgroup for all containers]:cgroup: " \
|
||||
"($help)--cluster-advertise=[Address or interface name to advertise]:Instance to advertise (host\:port): " \
|
||||
"($help)--cluster-store=[URL of the distributed storage backend]:Cluster Store:->cluster-store" \
|
||||
"($help)*--cluster-store-opt=[Cluster store options]:Cluster options:->cluster-store-options" \
|
||||
"($help)--config-file=[Path to daemon configuration file]:Config File:_files" \
|
||||
"($help)--containerd=[Path to containerd socket]:socket:_files -g \"*.sock\"" \
|
||||
"($help)--containerd-namespace=[Containerd namespace to use]:containerd namespace:" \
|
||||
@ -2778,7 +2772,7 @@ __docker_subcommand() {
|
||||
"($help)--oom-score-adjust=[Set the oom_score_adj for the daemon]:oom-score:(-500)" \
|
||||
"($help -p --pidfile)"{-p=,--pidfile=}"[Path to use for daemon PID file]:PID file:_files" \
|
||||
"($help)--raw-logs[Full timestamps without ANSI coloring]" \
|
||||
"($help)*--registry-mirror=[Preferred Docker registry mirror]:registry mirror: " \
|
||||
"($help)*--registry-mirror=[Preferred registry mirror]:registry mirror: " \
|
||||
"($help)--seccomp-profile=[Path to seccomp profile]:path:_files -g \"*.json\"" \
|
||||
"($help -s --storage-driver)"{-s=,--storage-driver=}"[Storage driver to use]:driver:(aufs btrfs devicemapper overlay overlay2 vfs zfs)" \
|
||||
"($help)--selinux-enabled[Enable selinux support]" \
|
||||
@ -2795,22 +2789,6 @@ __docker_subcommand() {
|
||||
"($help)--validate[Validate daemon configuration and exit]" && ret=0
|
||||
|
||||
case $state in
|
||||
(cluster-store)
|
||||
if compset -P '*://'; then
|
||||
_message 'host:port' && ret=0
|
||||
else
|
||||
store=('consul' 'etcd' 'zk')
|
||||
_describe -t cluster-store "Cluster Store" store -qS "://" && ret=0
|
||||
fi
|
||||
;;
|
||||
(cluster-store-options)
|
||||
if compset -P '*='; then
|
||||
_files && ret=0
|
||||
else
|
||||
opts=('discovery.heartbeat' 'discovery.ttl' 'kv.cacertfile' 'kv.certfile' 'kv.keyfile' 'kv.path')
|
||||
_describe -t cluster-store-opts "Cluster Store Options" opts -qS "=" && ret=0
|
||||
fi
|
||||
;;
|
||||
(users-groups)
|
||||
if compset -P '*:'; then
|
||||
_groups && ret=0
|
||||
@ -3095,6 +3073,7 @@ _docker() {
|
||||
_arguments $(__docker_arguments) -C \
|
||||
"(: -)"{-h,--help}"[Print usage]" \
|
||||
"($help)--config[Location of client config files]:path:_directories" \
|
||||
"($help -c --context)"{-c=,--context=}"[Execute the command in a docker context]:context:__docker_complete_contexts" \
|
||||
"($help -D --debug)"{-D,--debug}"[Enable debug mode]" \
|
||||
"($help -H --host)"{-H=,--host=}"[tcp://host:port to bind/connect to]:host: " \
|
||||
"($help -l --log-level)"{-l=,--log-level=}"[Logging level]:level:(debug info warn error fatal)" \
|
||||
@ -3110,7 +3089,8 @@ _docker() {
|
||||
|
||||
local host=${opt_args[-H]}${opt_args[--host]}
|
||||
local config=${opt_args[--config]}
|
||||
local docker_options="${host:+--host $host} ${config:+--config $config}"
|
||||
local context=${opt_args[-c]}${opt_args[--context]}
|
||||
local docker_options="${host:+--host $host} ${config:+--config $config} ${context:+--context $context} "
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
|
Loading…
Reference in New Issue
Block a user