Open kenden opened 6 years ago
Not reproing here:
✗ docker run -it
-P -- Publish all exposed ports
-a -- Attach to stdin, stdout or stderr
-c -- CPU shares (relative weight)
-d -- Detached mode: leave the container running in the background
-e -- Environment variables
-h -- Container host name
-l -- Container metadata
-m -- Memory limit
-p -- Expose a container's port to the host
-u -- Username or UID
-v -- Bind mount a volume
-w -- Working directory inside the container
If I add a space after the -it
, then attempt tab completion I see a list of all the images.
Are we sure oh-my-zsh is up to date?
Perhaps related to the "short-stacking option", which is disabled by default; https://github.com/docker/cli/blob/ec412bdbb47b0cd84d85a0212c7160cec0ee9f02/contrib/completion/zsh/_docker#L41-L43
@thaJeztah thanks, that's it. I uncommentted:
# zstyle ':completion:*:*:docker-*:*' option-stacking yes
and docker run -it
now autocompletes as (I think) it should.
The comment as to why this is disabled is here: https://github.com/moby/moby/pull/17124#issuecomment-150518700
Duplicate of, or rather duplicated by https://github.com/docker/cli/issues/2625.
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.
Type
docker
then press tab. If it shows you:then docker zsh autocomplete is enabled.
Type the following:
docker run -it
then 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 todocker 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:Output of
docker version
: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
:Additional environment details (AWS, VirtualBox, physical, etc.):
Using docker for mac.