Comments (11)
For those who are looking for Docker completion in Windows here is the list of currently available solutions:
- https://github.com/matt9ucci/DockerCompletion - quite recent commits present in repository, install with
Install-Module DockerCompletion
- https://github.com/samneirinck/posh-docker - I use this one - after installation with
Install-Module Posh-Docker
(administrative rights required) you can just addImport-Module Posh-Docker
tovendor/profile.ps1
in cmder directory
cc: @viskin
from clink-completions.
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.
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:
- The user writes the word docker (docker.exe) or docker-compose (or docker-compose.exe) on cmder and presses SPACE
- The user presses TAB after the previous step
- Cmder in this case executes the command "docker ps" in background (hidden from console)
- Cmder parses the result and extract the docker container names (if they exist) and store them in the memory as a list
- 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\
- The containers or files section are only showed if they exist, otherwise the section shall be hidden.
- The list in memory can only be updated after 20s has elapsed (after step 2) and the user presses TAB again
- 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.
- 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.
- 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.
@viskin, accepted. However, i'm not a user of Docker, so please don't expect this will be done soon, sorry.
from clink-completions.
Also, bash completions will be helpful, thanks.
from clink-completions.
@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.
@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.
Ok, thank you. I will look at it.
from clink-completions.
I am waiting for this feature 👍
from clink-completions.
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.
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:
- The user writes the word docker (docker.exe) or docker-compose (or docker-compose.exe) on cmder and presses SPACE
- The user presses TAB after the previous step
- Cmder in this case executes the command "docker ps" in background (hidden from console)
- Cmder parses the result and extract the docker container names (if they exist) and store them in the memory as a list
- 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\
- The containers or files section are only showed if they exist, otherwise the section shall be hidden.
- The list in memory can only be updated after 20s has elapsed (after step 2) and the user presses TAB again
- 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.
- 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.
- 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)
- adb.lua misbehaving HOT 1
- fastboot.lua and scrcpy.lua misbehaving too HOT 1
- Unwanted behaviour for `adb` and `scrcpy` completions. HOT 6
- git.lua:155: attempt to call upvalue 'w' (a nil value) HOT 8
- Run git pull on script folders after update HOT 3
- Error when completing ssh HOT 3
- Improve winget completion HOT 9
- openssl.lua:1179: attempt to compare number with string HOT 1
- Error "module 'path' not found" on fresh install. HOT 8
- Sudo Clink version mismatch HOT 6
- Winget completion throws error HOT 8
- Completion for Nuke.Build HOT 12
- git add completions are git root relative instead of cwd relative HOT 2
- Git add tries to add already added (renamed/moved) file HOT 2
- RFE: add completions for ping HOT 10
- Bug: completions from known_hosts for ssh and ping on non-default port HOT 5
- The new git_prompt.lua in 0.4.9 breaks custom non-cmder prompt HOT 6
- Add completions for arduino-cli HOT 1
- How to let 'git add' completion non-recursive HOT 7
- Add completions for go and rust tools
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clink-completions.