Uh oh!
There was an error while loading. Please reload this page.
Add completion for docker-compose plugin - #3158
Conversation
Codecov Report
@@ Coverage Diff @@## master #3158 +/- ##
==========================================
+ Coverage 57.08% 58.58% +1.50%
==========================================
Files 299 299 Lines 18756 21476 +2720 ==========================================
+ Hits 10707 12582 +1875 - Misses 7178 7972 +794 - Partials 871 922 +51 |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
I think this PR is a very good starting point to gain some experience with generated completions.
We could start with a hardcoded option to include completion for the compose plugin, as suggested in this PR.
The completion script could check the well-known install locations (/usr/libexec/docker/cli-plugins/ and ~/.docker/cli-plugins/ for the presence of the docker-compose plugin file. In case of a match, it should activate completion for the plugin.
In subsequent PRs, the completion script should be extended to provide a generic solution for client plugins.
The generated completion as implemented in this PR works quite well, but should also be improved in subsequent PRs. For example, I miss support for completion of local files (docker compose -f), and completion of service names (docker compose logs)
thaJeztah
commented
Jul 6, 2021
for #3158 (comment)
I opened #3179, which should be able to detect if we're only using local information (in which case it will skip making an API connection to the |
Uh oh!
There was an error while loading. Please reload this page.
albers
left a comment
There was a problem hiding this comment.
For consistency, please avoid unneccessary braces in variables, e.g. "${value}" should be just "$value". For the same reason please pull up the do.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
albers
left a comment
There was a problem hiding this comment.
Very well.
One last nit and a question.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
albers
left a comment
There was a problem hiding this comment.
LGTM, thanks!
ping @thaJeztah
thaJeztah
left a comment
There was a problem hiding this comment.
LGTM
tried it inside a container, and looks to work ok 👍
I also see spf13/cobra#1146 was merged, which looks to be improving cobra's completion scripts as well (instead of generating massive scripts)
ulyssessouza
commented
Jul 20, 2021
Thanks a lot @albers & @thaJeztah ! |
albers
commented
Jul 20, 2021
@ulyssessouza Please keep me up to date with your further work on generated completions. |
WIP: Note that this PR depends on the implementation of completions PR in
docker/compose-clito work.