-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add completion for docker-compose plugin #3158
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
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
|
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 |
albers
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency, please avoid unneccessary braces in variables, e.g. "${value}" should be just "$value". For the same reason please pull up the do.
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
albers
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very well.
One last nit and a question.
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
albers
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
ping @thaJeztah
thaJeztah
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
|
Thanks a lot @albers & @thaJeztah ! |
|
@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.