completion: fix / add completion for service names and node-names#5848
Merged
neersighted merged 4 commits intodocker:masterfrom Feb 20, 2025
Merged
completion: fix / add completion for service names and node-names#5848neersighted merged 4 commits intodocker:masterfrom
neersighted merged 4 commits intodocker:masterfrom
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5848 +/- ##
========================================
Coverage 58.81% 58.81%
========================================
Files 349 350 +1
Lines 29556 29676 +120
========================================
+ Hits 17382 17455 +73
- Misses 11189 11236 +47
Partials 985 985 |
vvoland
reviewed
Feb 20, 2025
vvoland
reviewed
Feb 20, 2025
…VICE_IDS Change completion for services to use names by default, and bring back support for the `DOCKER_COMPLETION_SHOW_SERVICE_IDS` env-var https://github.com/docker/cli/blob/f9ced58158d5e0b358052432244b483774a1983d/contrib/completion/bash/docker#L41-L43 Before this patch: docker service ps c9vrp2pwni9gx5ghat20rjpcy hmthf0tqws9xpmd87ok7diqly With this patch: docker service ps<TAB> databaseservice webservice export DOCKER_COMPLETION_SHOW_SERVICE_IDS=yes docker service ps<TAB> c9vrp2pwni9gx5ghat20rjpcy databaseservice hmthf0tqws9xpmd87ok7diqly webservice Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
23c1816 to
147a3cb
Compare
vvoland
reviewed
Feb 20, 2025
cli/command/node/demote.go
Outdated
Comment on lines
+21
to
+22
| ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { | ||
| return completeNodeNames(dockerCli)(cmd, args, toComplete) |
Collaborator
There was a problem hiding this comment.
Suggested change
| ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { | |
| return completeNodeNames(dockerCli)(cmd, args, toComplete) | |
| ValidArgsFunction: completeNodeNames(dockerCli) |
nit
Member
Author
There was a problem hiding this comment.
Doh! Good call; wouldn't surprise me if we did the same in other places (sometimes the closures trip me up for sure!)
Change completion for nodes to use names by default, and bring back support for the `DOCKER_COMPLETION_SHOW_NODE_IDS` env-var https://github.com/docker/cli/blob/f9ced58158d5e0b358052432244b483774a1983d/contrib/completion/bash/docker#L38 With this patch: docker node ps <tab> docker-desktop self export DOCKER_COMPLETION_SHOW_NODE_IDS=yes docker node ps <TAB> docker-desktop qyeriqk20al6hy4y869d08ff5 self Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
With this patch:
docker node update --role
manager worker
docker node update --availability
active drain pause
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Not all flags have completions yet, and for those that don't have completion, we disable completion to prevent it completing with filenames. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
147a3cb to
8f55738
Compare
vvoland
approved these changes
Feb 20, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
completion: use service names, and support DOCKER_COMPLETION_SHOW_SERVICE_IDS
Change completion for services to use names by default, and bring back
support for the
DOCKER_COMPLETION_SHOW_SERVICE_IDSenv-varcli/contrib/completion/bash/docker
Lines 41 to 43 in f9ced58
Before this patch:
With this patch:
completion: add completion for node names
Change completion for nodes to use names by default, and bring back
support for the
DOCKER_COMPLETION_SHOW_NODE_IDSenv-varcli/contrib/completion/bash/docker
Line 38 in f9ced58
With this patch:
completion: add completion for docker node flags
With this patch:
completion: add completion for docker service flags
Not all flags have completions yet, and for those that don't have completion,
we disable completion to prevent it completing with filenames.
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)