zsh completion breaks when optional arguments are combined (`-i -t` -> `-it`)
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 2.2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 43
Description
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: https://github.com/robbyrussell/oh-my-zsh/issues/6710
Steps to reproduce the issue:
- Make sure you are using zsh and check that the docker autocomplete is enabled.
Typedockerthen press tab.
If it shows you:
image -- Manage images
images -- List images
then docker zsh autocomplete is enabled.
- Type the following:
docker run -itthen press tab
--> **PROBLEM: **A list of executables on the PATH is displayed instead of possible arguments todocker 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with contrib/completion/zsh/_docker and reproduce the reported behavior using docker run -it and docker run -i -t in zsh with Docker autocomplete enabled. Compare how the completion script handles combined optional arguments; done means docker run -it offers possible Docker run arguments rather than executables from PATH.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, zsh
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100