This commit allows us to get shell completion for kubectl plugins. For example, with the use of a plugin named 'kubectl-krew', completing kubectl k<tab> will include 'krew' in the list of possible completions. Because the shell completion scripts are generated by Cobra, this commit took the approach of registering every plugin as a Cobra command. This makes Cobra aware of each plugin command when generating completions. For efficiency, searching for plugins and registering them as Cobra commands is only done when needed, which is when calling the 'kubectl completion' command in the case of bash, as it includes all commands and subcommands directly in the bash generated script. For the other shells, this will need to be done for the 'kubectl __complete' command, in a follow-up command. Co-authored-by: Marc Khouzam <marc.khouzam@montreal.ca> Signed-off-by: Kazuki Suda <kazuki.suda@gmail.com> Kubernetes-commit: 3db3ff53cdf4b106365c5de9194153fc371868a7 |
||
|---|---|---|
| .github | ||
| docs | ||
| images | ||
| pkg | ||
| testdata | ||
| CONTRIBUTING.md | ||
| LICENSE | ||
| OWNERS | ||
| README.md | ||
| SECURITY_CONTACTS | ||
| code-of-conduct.md | ||
| doc.go | ||
| go.mod | ||
| go.sum | ||
README.md
Kubectl
The k8s.io/kubectl repo is used to track issues for the kubectl cli distributed
with k8s.io/kubernetes. It also contains packages intended for use by client
programs. E.g. these packages are vendored into k8s.io/kubernetes for use in
the kubectl
cli client. That client will eventually move here too.
Contribution Requirements
-
Full unit-test coverage.
-
Go tools compliant (
go get,go test, etc.). It needs to be vendorable somewhere else. -
No dependence on
k8s.io/kubernetes. Dependence on other repositories is fine. -
Code must be usefully commented. Not only for developers on the project, but also for external users of these packages.
-
When reviewing PRs, you are encouraged to use Golang's code review comments page.
-
Packages in this repository should aspire to implement sensible, small interfaces and import a limited set of dependencies.
Community, discussion, contribution, and support
See this document for how to reach the maintainers of this project.
Code of conduct
Participation in the Kubernetes community is governed by the Kubernetes Code of Conduct.
