Giter Site home page Giter Site logo

Comments (11)

orestesgaolin avatar orestesgaolin commented on May 20, 2024 4

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

cc: @viskin

from clink-completions.

chrisant996 avatar chrisant996 commented on May 20, 2024 1

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.

from clink-completions.

chrisant996 avatar chrisant996 commented on May 20, 2024 1

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.

from clink-completions.

vladimir-kotikov avatar vladimir-kotikov commented on May 20, 2024

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

from clink-completions.

vladimir-kotikov avatar vladimir-kotikov commented on May 20, 2024

Also, bash completions will be helpful, thanks.

from clink-completions.

jkoenig134 avatar jkoenig134 commented on May 20, 2024

@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.

from clink-completions.

vladimir-kotikov avatar vladimir-kotikov commented on May 20, 2024

@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

from clink-completions.

jkoenig134 avatar jkoenig134 commented on May 20, 2024

Ok, thank you. I will look at it.

from clink-completions.

jocafi avatar jocafi commented on May 20, 2024

I am waiting for this feature 👍

from clink-completions.

chrisant996 avatar chrisant996 commented on May 20, 2024

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.

from clink-completions.

jocafi avatar jocafi commented on May 20, 2024

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 !

from clink-completions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.