compose
compose copied to clipboard
Add completion command and fix convert
What I did Add completion command and fix convert
To test, you can trigger the completions with the following example:
- Create a compose file with the following content:
compose.yaml
services:
foo:
image: nginx
bar:
image: nginx
baz:
image: nginx
- Then run the following command:
$ docker compose __complete up ""
This should print the 3 services as proposals
- By running
$ docker compose __complete up "b"
This should propose the 2 services starting with the letter "b"
For now, the Docker CLI is not triggering compose's completion yet. That should be done in a following PR.
Ah project name completion isn't working, it looks like the backend instance isn't initialized?
I'm getting not implemented error and all the funcs on the ServiceProxy are nil at the point that completeProjectNames is called 😭
Oh, we lazily initialize the ServiceProxy via PersistentPreRunE which presumably does NOT run for the auto-completion 😬
https://github.com/docker/compose/blob/db882416985a2d36ee82f869920ad9ce9d4c2caa/cmd/main.go#L41-L44
@milas Good catch! I changed to populate the serviceProxy on creation... We could actually get rid of this, but that can be useful on state tracing with interceptors.
Should this close #8550 as well?