zsh: allow short options to specify their arguments with "="

This is allowed by Docker and helps the completion to not get confused
when a user uses this notation. This will also help to enable stacking
of short options since Zsh needs that to not stack options with
arguments.

Signed-off-by: Vincent Bernat <vincent@bernat.im>
master
Vincent Bernat 2015-10-16 23:23:58 +02:00 committed by Tibor Vass
parent 060e6e1935
commit 2102746489
1 changed files with 45 additions and 45 deletions

View File

@ -252,7 +252,7 @@ __docker_network_subcommand() {
(create)
_arguments -A '-*' \
$opts_help \
"($help -d --driver)"{-d,--driver=}"[Driver to manage the Network]:driver:(null host bridge overlay)" \
"($help -d --driver)"{-d=,--driver=}"[Driver to manage the Network]:driver:(null host bridge overlay)" \
"($help)--ipam-driver=[IP Address Management Driver]:driver:(default)" \
"($help)*--subnet=[Subnet in CIDR format that represents a network segment]:IP/mask: " \
"($help)*--ip-range=[Allocate container ip from a sub-range]:IP/mask: " \
@ -334,20 +334,20 @@ __docker_volume_subcommand() {
(create)
_arguments \
$opts_help \
"($help -d --driver)"{-d,--driver=}"[Specify volume driver name]:Driver name: " \
"($help -d --driver)"{-d=,--driver=}"[Specify volume driver name]:Driver name: " \
"($help)--name=[Specify volume name]" \
"($help)*"{-o,--opt=}"[Set driver specific options]:Driver option: " && ret=0
"($help)*"{-o=,--opt=}"[Set driver specific options]:Driver option: " && ret=0
;;
(inspect)
_arguments \
$opts_help \
"($help -f --format)"{-f,--format=}"[Format the output using the given go template]:template: " \
"($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " \
"($help -)1:volume:__docker_volumes" && ret=0
;;
(ls)
_arguments \
$opts_help \
"($help)*"{-f,--filter=}"[Provide filter values (i.e. 'dangling=true')]:filter: " \
"($help)*"{-f=,--filter=}"[Provide filter values (i.e. 'dangling=true')]:filter: " \
"($help -q --quiet)"{-q,--quiet}"[Only display volume names]" && ret=0
;;
(rm)
@ -401,12 +401,12 @@ __docker_subcommand() {
"($help)--cpu-quota=[Limit the CPU CFS (Completely Fair Scheduler) quota]:CPU quota: "
"($help)--cpuset-cpus=[CPUs in which to allow execution]:CPUs: "
"($help)--cpuset-mems=[MEMs in which to allow execution]:MEMs: "
"($help -m --memory)"{-m,--memory=}"[Memory limit]:Memory limit: "
"($help -m --memory)"{-m=,--memory=}"[Memory limit]:Memory limit: "
"($help)--memory-swap=[Total memory limit with swap]:Memory limit: "
"($help)*--ulimit=[ulimit options]:ulimit: "
)
opts_create=(
"($help -a --attach)"{-a,--attach=}"[Attach to stdin, stdout or stderr]:device:(STDIN STDOUT STDERR)"
"($help -a --attach)"{-a=,--attach=}"[Attach to stdin, stdout or stderr]:device:(STDIN STDOUT STDERR)"
"($help)*--add-host=[Add a custom host-to-IP mapping]:host\:ip mapping: "
"($help)--blkio-weight=[Block IO (relative weight), between 10 and 1000]:Block IO weight:(10 100 500 1000)"
"($help)*--cap-add=[Add Linux capabilities]:capability: "
@ -416,17 +416,17 @@ __docker_subcommand() {
"($help)*--dns=[Set custom DNS servers]:DNS server: "
"($help)*--dns-opt=[Set custom DNS options]:DNS option: "
"($help)*--dns-search=[Set custom DNS search domains]:DNS domains: "
"($help)*"{-e,--env=}"[Set environment variables]:environment variable: "
"($help)*"{-e=,--env=}"[Set environment variables]:environment variable: "
"($help)--entrypoint=[Overwrite the default entrypoint of the image]:entry point: "
"($help)*--env-file=[Read environment variables from a file]:environment file:_files"
"($help)*--expose=[Expose a port from the container without publishing it]: "
"($help)*--group-add=[Add additional groups to run as]:group:_groups"
"($help -h --hostname)"{-h,--hostname=}"[Container host name]:hostname:_hosts"
"($help -h --hostname)"{-h=,--hostname=}"[Container host name]:hostname:_hosts"
"($help -i --interactive)"{-i,--interactive}"[Keep stdin open even if not attached]"
"($help)--ipc=[IPC namespace to use]:IPC namespace: "
"($help)--kernel-memory[Kernel memory limit in bytes.]:Memory limit: "
"($help)*--link=[Add link to another container]:link:->link"
"($help)*"{-l,--label=}"[Set meta data on a container]:label: "
"($help)*"{-l=,--label=}"[Set meta data on a container]:label: "
"($help)--log-driver=[Default driver for container logs]:Logging driver:(json-file syslog journald gelf fluentd awslogs splunk none)"
"($help)*--log-opt=[Log driver specific options]:log driver options: "
"($help)*--lxc-conf=[Add custom lxc options]:lxc options: "
@ -435,17 +435,17 @@ __docker_subcommand() {
"($help)--net=[Connect a container to a network]:network mode:(bridge none container host)"
"($help)--oom-kill-disable[Disable OOM Killer]"
"($help -P --publish-all)"{-P,--publish-all}"[Publish all exposed ports]"
"($help)*"{-p,--publish=}"[Expose a container's port to the host]:port:_ports"
"($help)*"{-p=,--publish=}"[Expose a container's port to the host]:port:_ports"
"($help)--pid=[PID namespace to use]:PID: "
"($help)--privileged[Give extended privileges to this container]"
"($help)--read-only[Mount the container's root filesystem as read only]"
"($help)--restart=[Restart policy]:restart policy:(no on-failure always unless-stopped)"
"($help)*--security-opt=[Security options]:security option: "
"($help -t --tty)"{-t,--tty}"[Allocate a pseudo-tty]"
"($help -u --user)"{-u,--user=}"[Username or UID]:user:_users"
"($help -u --user)"{-u=,--user=}"[Username or UID]:user:_users"
"($help)*-v[Bind mount a volume]:volume: "
"($help)*--volumes-from=[Mount volumes from the specified container]:volume: "
"($help -w --workdir)"{-w,--workdir=}"[Working directory inside the container]:directory:_directories"
"($help -w --workdir)"{-w=,--workdir=}"[Working directory inside the container]:directory:_directories"
)
case "$words[1]" in
@ -461,21 +461,21 @@ __docker_subcommand() {
$opts_help \
$opts_cpumemlimit \
"($help)*--build-arg[Set build-time variables]:<varname>=<value>: " \
"($help -f --file)"{-f,--file=}"[Name of the Dockerfile]:Dockerfile:_files" \
"($help -f --file)"{-f=,--file=}"[Name of the Dockerfile]:Dockerfile:_files" \
"($help)--force-rm[Always remove intermediate containers]" \
"($help)--no-cache[Do not use cache when building the image]" \
"($help)--pull[Attempt to pull a newer version of the image]" \
"($help -q --quiet)"{-q,--quiet}"[Suppress verbose build output]" \
"($help)--rm[Remove intermediate containers after a successful build]" \
"($help -t --tag)*"{-t,--tag=}"[Repository, name and tag for the image]: :__docker_repositories_with_tags" \
"($help -t --tag)*"{-t=,--tag=}"[Repository, name and tag for the image]: :__docker_repositories_with_tags" \
"($help -):path or URL:_directories" && ret=0
;;
(commit)
_arguments \
$opts_help \
"($help -a --author)"{-a,--author=}"[Author]:author: " \
"($help)*"{-c,--change=}"[Apply Dockerfile instruction to the created image]:Dockerfile:_files" \
"($help -m --message)"{-m,--message=}"[Commit message]:message: " \
"($help -a --author)"{-a=,--author=}"[Author]:author: " \
"($help)*"{-c=,--change=}"[Apply Dockerfile instruction to the created image]:Dockerfile:_files" \
"($help -m --message)"{-m=,--message=}"[Commit message]:message: " \
"($help -p --pause)"{-p,--pause}"[Pause container during commit]" \
"($help -):container:__docker_containers" \
"($help -): :__docker_repositories_with_tags" && ret=0
@ -519,7 +519,7 @@ __docker_subcommand() {
_arguments \
$opts_help \
"($help)--api-cors-header=[Set CORS headers in the remote API]:CORS headers: " \
"($help -b --bridge)"{-b,--bridge=}"[Attach containers to a network bridge]:bridge:_net_interfaces" \
"($help -b --bridge)"{-b=,--bridge=}"[Attach containers to a network bridge]:bridge:_net_interfaces" \
"($help)--bip=[Specify network bridge IP]" \
"($help -D --debug)"{-D,--debug}"[Enable debug mode]" \
"($help)--default-gateway[Container default gateway IPv4 address]:IPv4 address: " \
@ -532,14 +532,14 @@ __docker_subcommand() {
"($help)*--dns-opt=[DNS options to use]:DNS option: " \
"($help)*--default-ulimit=[Set default ulimit settings for containers]:ulimit: " \
"($help)--disable-legacy-registry[Do not contact legacy registries]" \
"($help -e --exec-driver)"{-e,--exec-driver=}"[Exec driver to use]:driver:(native lxc windows)" \
"($help -e --exec-driver)"{-e=,--exec-driver=}"[Exec driver to use]:driver:(native lxc windows)" \
"($help)*--exec-opt=[Set exec driver options]:exec driver options: " \
"($help)--exec-root=[Root of the Docker execdriver]:path:_directories" \
"($help)--fixed-cidr=[IPv4 subnet for fixed IPs]:IPv4 subnet: " \
"($help)--fixed-cidr-v6=[IPv6 subnet for fixed IPs]:IPv6 subnet: " \
"($help -G --group)"{-G,--group=}"[Group for the unix socket]:group:_groups" \
"($help -g --graph)"{-g,--graph=}"[Root of the Docker runtime]:path:_directories" \
"($help -H --host)"{-H,--host=}"[tcp://host:port to bind/connect to]:host: " \
"($help -G --group)"{-G=,--group=}"[Group for the unix socket]:group:_groups" \
"($help -g --graph)"{-g=,--graph=}"[Root of the Docker runtime]:path:_directories" \
"($help -H --host)"{-H=,--host=}"[tcp://host:port to bind/connect to]:host: " \
"($help)--icc[Enable inter-container communication]" \
"($help)*--insecure-registry=[Enable insecure registry communication]:registry: " \
"($help)--ip=[Default IP when binding container ports]" \
@ -547,14 +547,14 @@ __docker_subcommand() {
"($help)--ip-masq[Enable IP masquerading]" \
"($help)--iptables[Enable addition of iptables rules]" \
"($help)--ipv6[Enable IPv6 networking]" \
"($help -l --log-level)"{-l,--log-level=}"[Set the logging level]:level:(debug info warn error fatal)" \
"($help -l --log-level)"{-l=,--log-level=}"[Set the logging level]:level:(debug info warn error fatal)" \
"($help)*--label=[Set key=value labels to the daemon]:label: " \
"($help)--log-driver=[Default driver for container logs]:Logging driver:(json-file syslog journald gelf fluentd awslogs splunk none)" \
"($help)*--log-opt=[Log driver specific options]:log driver options: " \
"($help)--mtu=[Set the containers network MTU]:mtu:(0 576 1420 1500 9000)" \
"($help -p --pidfile)"{-p,--pidfile=}"[Path to use for daemon PID file]:PID file:_files" \
"($help -p --pidfile)"{-p=,--pidfile=}"[Path to use for daemon PID file]:PID file:_files" \
"($help)*--registry-mirror=[Preferred Docker registry mirror]:registry mirror: " \
"($help -s --storage-driver)"{-s,--storage-driver=}"[Storage driver to use]:driver:(aufs devicemapper btrfs zfs overlay)" \
"($help -s --storage-driver)"{-s=,--storage-driver=}"[Storage driver to use]:driver:(aufs devicemapper btrfs zfs overlay)" \
"($help)--selinux-enabled[Enable selinux support]" \
"($help)*--storage-opt=[Set storage driver options]:storage driver options: " \
"($help)--tls[Use TLS]" \
@ -591,7 +591,7 @@ __docker_subcommand() {
(events)
_arguments \
$opts_help \
"($help)*"{-f,--filter=}"[Filter values]:filter: " \
"($help)*"{-f=,--filter=}"[Filter values]:filter: " \
"($help)--since=[Events created since this timestamp]:timestamp: " \
"($help)--until=[Events created until this timestamp]:timestamp: " && ret=0
;;
@ -603,7 +603,7 @@ __docker_subcommand() {
"($help -i --interactive)"{-i,--interactive}"[Keep stdin open even if not attached]" \
"($help)--privileged[Give extended Linux capabilities to the command]" \
"($help -t --tty)"{-t,--tty}"[Allocate a pseudo-tty]" \
"($help -u --user)"{-u,--user=}"[Username or UID]:user:_users" \
"($help -u --user)"{-u=,--user=}"[Username or UID]:user:_users" \
"($help -):containers:__docker_runningcontainers" \
"($help -)*::command:->anycommand" && ret=0
@ -618,7 +618,7 @@ __docker_subcommand() {
(export)
_arguments \
$opts_help \
"($help -o --output)"{-o,--output=}"[Write to a file, instead of stdout]:output file:_files" \
"($help -o --output)"{-o=,--output=}"[Write to a file, instead of stdout]:output file:_files" \
"($help -)*:containers:__docker_containers" && ret=0
;;
(history)
@ -634,7 +634,7 @@ __docker_subcommand() {
$opts_help \
"($help -a --all)"{-a,--all}"[Show all images]" \
"($help)--digest[Show digests]" \
"($help)*"{-f,--filter=}"[Filter values]:filter: " \
"($help)*"{-f=,--filter=}"[Filter values]:filter: " \
"($help)--no-trunc[Do not truncate output]" \
"($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \
"($help -): :__docker_repositories" && ret=0
@ -642,8 +642,8 @@ __docker_subcommand() {
(import)
_arguments \
$opts_help \
"($help)*"{-c,--change=}"[Apply Dockerfile instruction to the created image]:Dockerfile:_files" \
"($help -m --message)"{-m,--message=}"[Set commit message for imported image]:message: " \
"($help)*"{-c=,--change=}"[Apply Dockerfile instruction to the created image]:Dockerfile:_files" \
"($help -m --message)"{-m=,--message=}"[Set commit message for imported image]:message: " \
"($help -):URL:(- http:// file://)" \
"($help -): :__docker_repositories_with_tags" && ret=0
;;
@ -655,7 +655,7 @@ __docker_subcommand() {
local state
_arguments \
$opts_help \
"($help -f --format)"{-f,--format=}"[Format the output using the given go template]:template: " \
"($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " \
"($help -s --size)"{-s,--size}"[Display total file sizes if the type is container]" \
"($help)--type=[Return JSON for specified type]:type:(image container)" \
"($help -)*: :->values" && ret=0
@ -675,20 +675,20 @@ __docker_subcommand() {
(kill)
_arguments \
$opts_help \
"($help -s --signal)"{-s,--signal=}"[Signal to send]:signal:_signals" \
"($help -s --signal)"{-s=,--signal=}"[Signal to send]:signal:_signals" \
"($help -)*:containers:__docker_runningcontainers" && ret=0
;;
(load)
_arguments \
$opts_help \
"($help -i --input)"{-i,--input=}"[Read from tar archive file]:archive file:_files -g "*.((tar|TAR)(.gz|.GZ|.Z|.bz2|.lzma|.xz|)|(tbz|tgz|txz))(-.)"" && ret=0
"($help -i --input)"{-i=,--input=}"[Read from tar archive file]:archive file:_files -g "*.((tar|TAR)(.gz|.GZ|.Z|.bz2|.lzma|.xz|)|(tbz|tgz|txz))(-.)"" && ret=0
;;
(login)
_arguments \
$opts_help \
"($help -e --email)"{-e,--email=}"[Email]:email: " \
"($help -p --password)"{-p,--password=}"[Password]:password: " \
"($help -u --user)"{-u,--user=}"[Username]:username: " \
"($help -e --email)"{-e=,--email=}"[Email]:email: " \
"($help -p --password)"{-p=,--password=}"[Password]:password: " \
"($help -u --user)"{-u=,--user=}"[Username]:username: " \
"($help -)1:server: " && ret=0
;;
(logout)
@ -700,7 +700,7 @@ __docker_subcommand() {
_arguments \
$opts_help \
"($help -f --follow)"{-f,--follow}"[Follow log output]" \
"($help -s --since)"{-s,--since=}"[Show logs since this timestamp]:timestamp: " \
"($help -s --since)"{-s=,--since=}"[Show logs since this timestamp]:timestamp: " \
"($help -t --timestamps)"{-t,--timestamps}"[Show timestamps]" \
"($help)--tail=[Output the last K lines]:lines:(1 10 20 50 all)" \
"($help -)*:containers:__docker_containers" && ret=0
@ -738,7 +738,7 @@ __docker_subcommand() {
$opts_help \
"($help -a --all)"{-a,--all}"[Show all containers]" \
"($help)--before=[Show only container created before...]:containers:__docker_containers" \
"($help)*"{-f,--filter=}"[Filter values]:filter: " \
"($help)*"{-f=,--filter=}"[Filter values]:filter: " \
"($help)--format[Pretty-print containers using a Go template]:format: " \
"($help -l --latest)"{-l,--latest}"[Show only the latest created container]" \
"($help)-n[Show n last created containers, include non-running one]:n:(1 5 10 25 50)" \
@ -767,7 +767,7 @@ __docker_subcommand() {
(restart|stop)
_arguments \
$opts_help \
"($help -t --time)"{-t,--time=}"[Number of seconds to try to stop for before killing the container]:seconds to before killing:(1 5 10 30 60)" \
"($help -t --time)"{-t=,--time=}"[Number of seconds to try to stop for before killing the container]:seconds to before killing:(1 5 10 30 60)" \
"($help -)*:containers:__docker_runningcontainers" && ret=0
;;
(rm)
@ -812,7 +812,7 @@ __docker_subcommand() {
(save)
_arguments \
$opts_help \
"($help -o --output)"{-o,--output=}"[Write to file]:file:_files" \
"($help -o --output)"{-o=,--output=}"[Write to file]:file:_files" \
"($help -)*: :__docker_images" && ret=0
;;
(search)
@ -820,7 +820,7 @@ __docker_subcommand() {
$opts_help \
"($help)--automated[Only show automated builds]" \
"($help)--no-trunc[Do not truncate output]" \
"($help -s --stars)"{-s,--stars=}"[Only display with at least X stars]:stars:(0 10 100 1000)" \
"($help -s --stars)"{-s=,--stars=}"[Only display with at least X stars]:stars:(0 10 100 1000)" \
"($help -):term: " && ret=0
;;
(start)
@ -901,8 +901,8 @@ _docker() {
"(: -)"{-h,--help}"[Print usage]" \
"($help)--config[Location of client config files]:path:_directories" \
"($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=}"[Set the logging level]:level:(debug info warn error fatal)" \
"($help -H --host)"{-H=,--host=}"[tcp://host:port to bind/connect to]:host: " \
"($help -l --log-level)"{-l=,--log-level=}[Set the logging level]:level:(debug info warn error fatal)" \
"($help)--tls[Use TLS]" \
"($help)--tlscacert=[Trust certs signed only by this CA]:PEM file:_files -g "*.(pem|crt)"" \
"($help)--tlscert=[Path to TLS certificate file]:PEM file:_files -g "*.(pem|crt)"" \