completion: add completion for swarm "--filter" flags - #7124
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The migration to the generated (V2) shell completions dropped the "--filter" key/value suggestions that the legacy bash completion used to provide for the swarm commands, so e.g. "docker service ps <service> --filter <TAB>" no longer completed anything. Register filter completions for "docker service ps", "docker service ls", and "docker node ps", following the same approach as the existing completion for "docker events --filter". Signed-off-by: Jess Thrysoee <jess@thrysoee.dk>
e5f6e05 to
89e882a
Compare
| // Task IDs, names, and labels are not easily discoverable; only offer the key. | ||
| return nil, cobra.ShellCompDirectiveNoFileComp |
There was a problem hiding this comment.
I'm guessing the old bash-completion couldn't easily do this because the CLI does not have a comment to list tasks, but as a follow up we could look if we actually could use the API client for this;
Lines 75 to 82 in 4f7c07c
Definitely OK for a follow-up though, no need to cramp it into this PR.
There was a problem hiding this comment.
label=a TaskList/ServiceList call and pluck the label from the Itemsname=a little heavier with multiple api calls, should system.taskNames be made available for this?id=probably not as useful, but also just a TaskList call
But I think you are right, this feels like a separate PR.
There was a problem hiding this comment.
Yup! No need to do it for this one; I was only glancing over the changes (at a glance they look great! but will have a closer look tomorrow), and was thinking out loud to see if we could fill in the remaining bits.
But indeed; more than fine for a follow-up, so that we can see if it makes sense (outweigh the overhead against how much it improves).
There was a problem hiding this comment.
(marked it "unresolved" so that it stays visible, but no need to fix)
The migration to the generated (V2) shell completions dropped the "--filter" key/value suggestions that the legacy bash completion used to provide for the swarm commands, so e.g. "docker service ps --filter " no longer completed anything.
Register filter completions for "docker service ps", "docker service ls", and "docker node ps", following the same approach as the existing completion for "docker events --filter".