dockerd: enable shell-completion; add (hidden) completion subcommand#49339
Merged
thaJeztah merged 1 commit intomoby:masterfrom Jan 27, 2025
Merged
dockerd: enable shell-completion; add (hidden) completion subcommand#49339thaJeztah merged 1 commit intomoby:masterfrom
thaJeztah merged 1 commit intomoby:masterfrom
Conversation
This required a minor hack to accommodate Cobra's logic (and a TODO was
added to see if we can improve that logic in upstream). Some changes also
had to be made to our "Usage" template, as our custom template did not
take into account subcommands and long descriptions for commands. We
should review these templates, as some additional features were added
in upstream Cobra that we currently may not be using.
With this patch:
instructions for the (hidden) completion subcommand:
docker completion --help
Usage: docker completion COMMAND
Generate the autocompletion script for docker for the specified shell.
See each sub-command's help for details on how to use the generated script.
Commands:
bash Generate the autocompletion script for bash
fish Generate the autocompletion script for fish
powershell Generate the autocompletion script for powershell
zsh Generate the autocompletion script for zsh
Run 'docker completion COMMAND --help' for more information on a command.
and instructions for installing:
dockerd completion bash --help
Usage: dockerd completion bash
Generate the autocompletion script for the bash shell.
This script depends on the 'bash-completion' package.
If it is not installed already, you can install it via your OS's package manager.
To load completions in your current shell session:
source <(dockerd completion bash)
To load completions for every new session, execute once:
#### Linux:
dockerd completion bash > /etc/bash_completion.d/dockerd
#### macOS:
dockerd completion bash > $(brew --prefix)/etc/bash_completion.d/dockerd
You will need to start a new shell for this setup to take effect.
Options:
--help Print usage
--no-descriptions disable completion descriptions
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Member
Author
|
With this PR: source <(dockerd completion bash)
dockerd --default-<TAB>
--default-address-pool (Default address pools for node specific local networks)
--default-cgroupns-mode (Default mode for containers cgroup namespace ("host" | "private"))
--default-gateway (Container default gateway IPv4 address)
--default-gateway-v6 (Container default gateway IPv6 address)
--default-ipc-mode (Default mode for containers ipc ("shareable" | "private"))
--default-network-opt (Default network options)
--default-runtime (Default OCI runtime for containers)
--default-shm-size (Default shm size for containers)
--default-ulimit (Default ulimits for containers)After this PR, we need to improve the code to provide completion for flag values, so this is just the initial start. |
1 task
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.
This required a minor hack to accommodate Cobra's logic (and a TODO was added to see if we can improve that logic in upstream). Some changes also had to be made to our "Usage" template, as our custom template did not take into account subcommands and long descriptions for commands. We should review these templates, as some additional features were added in upstream Cobra that we currently may not be using.
With this patch:
instructions for the (hidden) completion subcommand:
and instructions for installing:
- What I did
- How I did it
- How to verify it
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)