kubectl/pkg
Marc Khouzam d2df859d92 Add support for shell completion for plugins
When doing completion for arguments or flags for a plugin, kubectl will
call "kubectl_complete-<plugin>" to obtain the list of completions.
For example, for "krew" plugin, when the user triggers completion using:

$ kubectl krew <tab><tab>

kubectl will look for an executable file called "kubectl_complete-krew".
This file should print the list of valid completions for the plugin to
stdout.  Using cobra.ShellCompDirective as the last line of the output
is supported as is done by Cobra.

We also clear global flags when doing plugin completion because plugins
don't necessarily accept the global kubectl flags.  If some plugins do,
they will need to include such flags in their kubectl_complete-<plugin>
output.

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: befc8da7efa5d961d9ade4eadc706292c7ca5a64
2021-09-15 21:44:07 -04:00
..
apply Remove `newlineReporter` custom report 2022-06-01 13:09:47 +08:00
apps Remove `newlineReporter` custom report 2022-06-01 13:09:47 +08:00
cmd Add support for shell completion for plugins 2021-09-15 21:44:07 -04:00
describe Remove references to openstack and cinder 2022-08-08 16:01:59 -04:00
drain Generalize dry run verify to arbitrary query param 2022-03-09 14:51:50 +00:00
explain unit test v2 explain package 2022-10-17 13:59:17 -07:00
generate Clean unused generators 2021-03-03 22:47:53 +01:00
metricsutil Added --sum flag to kubectl top pod 2021-09-16 09:28:30 -04:00
polymorphichelpers Generate and format files 2022-07-19 20:54:13 -04:00
proxy kubectl proxy: append context host path to request path 2020-12-16 17:37:44 +01:00
rawhttp Close the used file 2021-06-03 15:36:20 +08:00
scale Support kubectl scale --dry-run=server|client 2020-03-30 17:33:15 -04:00
scheme Promote cronjob to batch/v1: kubectl sparse_test prune 2021-05-26 20:08:36 +08:00
util add unit test for normalizer rendering markdown 2022-09-27 14:06:40 +08:00
validation add server-side validation support to kubectl 2022-03-09 14:52:32 +00:00