Skip to content

Add bash completion for kubernetes orchestrator#1254

Merged
thaJeztah merged 3 commits into
docker:masterfrom
albers:completion-kubernetes
Aug 2, 2018
Merged

Add bash completion for kubernetes orchestrator#1254
thaJeztah merged 3 commits into
docker:masterfrom
albers:completion-kubernetes

Conversation

@albers
Copy link
Copy Markdown
Collaborator

@albers albers commented Aug 1, 2018

Depends on #1251 edit: #1251 was merged.

This

  • adds completions for kubernetes-specific options if kubernetes orchestrator is configured
  • hides completions for swarm-specific options unless swarm orchestrator is configured

The configured orchestrator is determined from the output of docker stack deploy|ls --help.
As the required help output is broken in 18.06.0 (see #1243) this work depends on #1251.

To test before #1251 is merged, just use a binary built at #1251.
I recommend using export DOCKER_STACK_ORCHESTRATOR=kubernetes|swarm|all, then invoking the completions of docker stack (deploy|ls|ps|rm|services)? -- and docker version --.

Thanks @silvin-lubecki for fixing the help output so fast.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Aug 1, 2018

Codecov Report

Merging #1254 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1254   +/-   ##
=======================================
  Coverage   54.27%   54.27%           
=======================================
  Files         268      268           
  Lines       17848    17848           
=======================================
  Hits         9687     9687           
  Misses       7551     7551           
  Partials      610      610

__docker_complete_stack_orchestrator_options && return

case "$prev" in
--bundle-file)
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the selective completion here although it is correct behavior.

The important part is that --bundle-file is not completed if it is not appropriate, which is already taken care for.
If someone insists on manually typing this option, he will now get it completed although it does not exist in this context.
This is an error, but given the growing complexity of hiding options based on operating system, client/server experimental state and orchestrator replicating the hiding logic in the individual option's completions will bloat the code without much value.

Copy link
Copy Markdown
Contributor

@silvin-lubecki silvin-lubecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM, thank you @albers !

albers added 3 commits August 2, 2018 13:54
Signed-off-by: Harald Albers <github@albersweb.de>
Signed-off-by: Harald Albers <github@albersweb.de>
Signed-off-by: Harald Albers <github@albersweb.de>
@albers albers force-pushed the completion-kubernetes branch from 83af9a0 to 08f8ee1 Compare August 2, 2018 11:57
@albers
Copy link
Copy Markdown
Collaborator Author

albers commented Aug 2, 2018

rebased in order to pull in #1251.

Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🤗

@thaJeztah thaJeztah merged commit 731b4f1 into docker:master Aug 2, 2018
@GordonTheTurtle GordonTheTurtle added this to the 18.09.0 milestone Aug 2, 2018
@albers albers deleted the completion-kubernetes branch August 3, 2018 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants