Skip to content

zsh completion breaks when optional arguments are combined (-i -t -> -it) #993

Description

@kenden

BUG REPORT INFORMATION

Description

docker zsh completion breaks when optional arguments are combined.
Example, when -i and -t are combined to -it

This problem was reported here: ohmyzsh/ohmyzsh#6710

Steps to reproduce the issue:

  1. Make sure you are using zsh and check that the docker autocomplete is enabled.
    Type docker then press tab.
    If it shows you:
image   -- Manage images
images  -- List images

then docker zsh autocomplete is enabled.

  1. Type the following:
    docker run -it then press tab
    --> **PROBLEM: **A list of executables on the PATH is displayed instead of possible arguments to docker run

Describe the results you received:

When typing docker run -it and pressing tab, a list of executables on the PATH is displayed.

Describe the results you expected:

When typing docker run -it and pressing tab, I expect to get a list of possible arguments to docker run

Additional information you deem important (e.g. issue happens only occasionally):

When not combining options, it works fine. Ex, when typing
docker run -i -t and pressing tab, I get:

02f9d6707661  -- 18.04           in ubuntu
0458a4468cbc  -- xenial-20180123 in ubuntu
3fd9065eaf02  -- latest          in alpine
4ea294712533  -- latest          in nate/dockviz
5b117edd0b76  -- 12.04           in ubuntu

Output of docker version:

$ docker version
Client:
 Version:	18.03.0-ce
 API version:	1.37
 Go version:	go1.9.4
 Git commit:	0520e24
 Built:	Wed Mar 21 23:06:22 2018
 OS/Arch:	darwin/amd64
 Experimental:	false
 Orchestrator:	swarm

Server:
 Engine:
  Version:	18.03.0-ce
  API version:	1.37 (minimum version 1.12)
  Go version:	go1.9.4
  Git commit:	0520e24
  Built:	Wed Mar 21 23:14:32 2018
  OS/Arch:	linux/amd64
  Experimental:	true

I tried using the current lastest version available at https://github.com/docker/cli/blob/ec412bdbb47b0cd84d85a0212c7160cec0ee9f02/contrib/completion/zsh/_docker
(put the content of that file to ~/.oh-my-zsh/plugins/docker/_docker)
with the same result.

Output of docker info:

$ docker info
Containers: 8
 Running: 1
 Paused: 0
 Stopped: 7
Images: 16
Server Version: 18.03.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host ipvlan macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: cfd04396dc68220d1cecbe686a6cc3aa5ce3667c
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.87-linuxkit-aufs
Operating System: Docker for Mac
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 1.952GiB
Name: linuxkit-025000000001
ID: QOY4:456J:JD4J:E36Y:G6FJ:YAJS:K3HI:J23J:NLV2:OFCV:ZNOY:STQT
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 31
 Goroutines: 56
 System Time: 2018-04-10T08:07:26.055313Z
 EventsListeners: 2
HTTP Proxy: docker.for.mac.http.internal:3128
HTTPS Proxy: docker.for.mac.http.internal:3129
Registry: https://index.docker.io/v1/
Labels:
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

Additional environment details (AWS, VirtualBox, physical, etc.):

Using docker for mac.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions