Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add completion for 'docker' #40

Open
viskin opened this issue Dec 7, 2015 · 11 comments
Open

Add completion for 'docker' #40

viskin opened this issue Dec 7, 2015 · 11 comments
Labels
enhancement Planned enhancement feature-request A requested enhancement help wanted
Milestone

Comments

@viskin
Copy link

viskin commented Dec 7, 2015

Docker client is popular tool that now available on Windows:
https://docs.docker.com/windows/step_one/
It comes with bash completion file:
https://github.com/docker/docker/blob/master/contrib/completion/bash/docker

@vladimir-kotikov vladimir-kotikov added this to the v0.3.0 milestone Dec 7, 2015
@vladimir-kotikov vladimir-kotikov added the feature-request A requested enhancement label Dec 7, 2015
@vladimir-kotikov
Copy link
Owner

@viskin, accepted. However, i'm not a user of Docker, so please don't expect this will be done soon, sorry.

@vladimir-kotikov
Copy link
Owner

Also, bash completions will be helpful, thanks.

@vladimir-kotikov vladimir-kotikov modified the milestones: future, v0.4.0 Nov 23, 2016
@orestesgaolin
Copy link

orestesgaolin commented Jan 15, 2018

For those who are looking for Docker completion in Windows here is the list of currently available solutions:

cc: @viskin

@jkoenig134
Copy link

@vladimir-kotikov do you plan to add the docker-completion?
The new bash-completion file for docker is located here.
A command completion for docker-compose would also be awesome. The completion for that is located here.

@vladimir-kotikov
Copy link
Owner

@jkoenig134 I don't as I'm not actively working on this project. There's a PR with basic completions here: #73 which you can grab and put along with other lua files in your cmder installation and get these completions working - I'd love to merge that PR but have some concerns about the implementation so still haven't decided about it

@jkoenig134
Copy link

Ok, thank you. I will look at it.

@chrisant996
Copy link
Collaborator

I see the implementation concerns Vladimir had, and I also see why the implementation was done that way, given limitations in Clink v0.4.9.

But newer versions of Clink natively support delayed initialization of argmatchers, so this is very doable now.

I'll look at getting docker completions included.

@chrisant996 chrisant996 added the enhancement Planned enhancement label Aug 15, 2022
@jocafi
Copy link

jocafi commented Aug 27, 2023

I am waiting for this feature 👍

@chrisant996
Copy link
Collaborator

I know nothing about docker and have never used it. That makes it extremely difficult for me to personally be the one to hook up completions for docker as I have absolutely no way to test them.

@jocafi
Copy link

jocafi commented Aug 28, 2023

Hi @chrisant996, the docker autocomplete feature exists for other terminals.

I know that if I press TAB in the cmder console after typing the letters do, the following results are shown in my case:

docker.exe docker-compose-v1.exe docker-credential-ecr-login.exe docker-index.exe doskey.exe docker-compose.exe docker-credential-desktop.exe docker-credential-wincred.exe dos2unix.exe

If I start any command on cmder, for example "cat " with space at the end and press TAB, cmder shows the files or directories of the actual path.

I wrote down some requirements to develop and test this feature. For sure you need to install docker on your machine and pull some small containers in order to test the feature. I can help you in this matter, if you want.

Requirements:

  1. The user writes the word docker (docker.exe) or docker-compose (or docker-compose.exe) on cmder and presses SPACE
  2. The user presses TAB after the previous step
  3. Cmder in this case executes the command "docker ps" in background (hidden from console)
  4. Cmder parses the result and extract the docker container names (if they exist) and store them in the memory as a list
  5. cmder shows the list of files / directories and the list of containers on the console (same feature as showing the files in the console in the actual version) separated by a header. Example:

Containers:
my-postgres my-mongo-db my-node-web-server

Files or directories:
.dockerignore app.js Dockerfile package.json config\

  1. The containers or files section are only showed if they exist, otherwise the section shall be hidden.
  2. The list in memory can only be updated after 20s has elapsed (after step 2) and the user presses TAB again
  3. If the user starts typing a word and presses TAB, cmder checks if the typed letters matches the start string of a file/dir or container in the memory list.
  4. If the pressed letter(s) match(es) only one word, cmder completes the word automatically. This is the actual behaviour, but it works only for files / dir.
  5. If the word matches two or more words, cmder shows the list in the console as explained in the step 5.

If you have questions, feel free to contact me.
Thank you !

@chrisant996
Copy link
Collaborator

I know that if I press TAB in the cmder console after typing the letters do, the following results are shown in my case:

docker.exe docker-compose-v1.exe docker-credential-ecr-login.exe docker-index.exe doskey.exe docker-compose.exe docker-credential-desktop.exe docker-credential-wincred.exe dos2unix.exe

That's because you have docker installed. Those are not docker completions, those are filename completions. Docker completions wouldn't start until after you type the program name.

If I start any command on cmder, for example "cat " with space at the end and press TAB, cmder shows the files or directories of the actual path.

Are you trying to help me understand what completions are and how they work? I'm the maintainer of the Clink program, and I'm familiar with how completions work in general and in Clink. What you described is basic filename completion that happens when there is no argmatcher completion script for a program.

I wrote down some requirements to develop and test this feature. For sure you need to install docker on your machine and pull some small containers in order to test the feature. I can help you in this matter, if you want.

I'm not volunteering to write docker completions. I'm not volunteering to install docker and learn docker. That would be a large investment of my time, for something I don't use (and won't have any reason to use any time in the foreseeable future).

If docker completions are to be written, someone who uses docker should do so. I can help with specific questions about how to do various things in Lua when writing completion scripts for Clink. The place to start is the Clink documentation, and especially the section Argument Completion.

Requirements:

  1. The user writes the word docker (docker.exe) or docker-compose (or docker-compose.exe) on cmder and presses SPACE
  2. The user presses TAB after the previous step
  3. Cmder in this case executes the command "docker ps" in background (hidden from console)
  4. Cmder parses the result and extract the docker container names (if they exist) and store them in the memory as a list
  5. cmder shows the list of files / directories and the list of containers on the console (same feature as showing the files in the console in the actual version) separated by a header. Example:

Containers: my-postgres my-mongo-db my-node-web-server

Files or directories: .dockerignore app.js Dockerfile package.json config\

  1. The containers or files section are only showed if they exist, otherwise the section shall be hidden.
  2. The list in memory can only be updated after 20s has elapsed (after step 2) and the user presses TAB again
  3. If the user starts typing a word and presses TAB, cmder checks if the typed letters matches the start string of a file/dir or container in the memory list.
  4. If the pressed letter(s) match(es) only one word, cmder completes the word automatically. This is the actual behaviour, but it works only for files / dir.
  5. If the word matches two or more words, cmder shows the list in the console as explained in the step 5.

If you have questions, feel free to contact me. Thank you !

Replace "cmder" with "a docker completion script written for clink": Cmder or ConEmu aren't involved in any of the above.

The requirements list above can be reduced to a single requirement (everything else is just basics of how completions work in general).

  • Completions after "docker" should list containers and files.

But docker also has commands and flags, and there should be completions for those, as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Planned enhancement feature-request A requested enhancement help wanted
Projects
None yet
Development

No branches or pull requests

6 participants