kubectl/pkg/cmd
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
..
annotate add setErr 2022-06-21 17:57:48 +08:00
apiresources style: remove redundant judgment 2022-07-29 18:25:05 +08:00
apply fix that beginning of help text is cut off for apply and replace --filename flag 2022-07-28 11:33:34 +08:00
attach Fix error message in attach_test.go 2022-07-17 12:38:26 +02:00
auth Split the API error in two 2022-09-29 11:50:33 +02:00
autoscale Refactor completion code into its own package 2022-03-24 09:06:05 -04:00
certificates (kubectl certificate): Move towards restClientGetter instead cmdutil.Factory 2022-08-04 11:36:03 +03:00
clusterinfo (kubectl cluster-info): Move towards RESTClientGetter instead cmdutil.Factory 2022-08-04 13:08:55 +03:00
completion Add support for shell completion for plugins 2021-09-15 21:44:07 -04:00
config Change reflect.Ptr to reflect.Pointer 2022-06-26 01:23:43 +09:00
cp Set validate functions requiring no parameters for all commands 2022-05-17 11:38:20 +03:00
create style: remove redundant judgment 2022-07-29 18:25:05 +08:00
debug Generate and format files 2022-07-19 20:54:13 -04:00
delete Typo in kubectl delete --help 111302 2022-07-21 20:42:30 +08:00
describe Refactors describe command to split flags from options 2022-09-23 12:16:43 +05:30
diff Change kubectl diff to exclude managedFields by default 2022-07-27 12:53:32 -04:00
drain add a warning printer in cli-runtime to coordinate warning style 2022-02-18 20:33:38 +08:00
edit updates for kubectl generated ref docs 2022-03-25 12:31:12 -07:00
events Add new flags into alpha events 2022-05-10 13:09:59 +03:00
exec Refactor completion code into its own package 2022-03-24 09:06:05 -04:00
explain add `KUBECTL_EXPLAIN_OPENAPIV3` envar to gate new explain implementation 2022-10-12 08:37:41 -07:00
expose style: remove redundant judgment 2022-07-29 18:25:05 +08:00
get grammar: replace all occurrences of "the the" with "the" 2022-09-17 22:58:01 +02:00
help Move pkg/kubectl/cmd/{command} to staging 2019-08-01 11:01:40 -07:00
kustomize Manually update kustomize attachment points. 2021-07-01 17:10:28 -07:00
label Fix label output bug where dry run message was not printed 2022-07-30 09:27:42 -04:00
logs Refactor completion code into its own package 2022-03-24 09:06:05 -04:00
options replace deprecated setoutput 2022-04-05 14:04:22 +08:00
patch (kubectl patch): Add descriptive message when patch type is unsupported 2022-09-19 10:15:04 +03:00
plugin Add support for shell completion for plugins 2021-09-15 21:44:07 -04:00
portforward Refactor completion code into its own package 2022-03-24 09:06:05 -04:00
proxy Minor adjustments to descriptions and example text 2021-07-06 15:05:26 -04:00
replace fix that beginning of help text is cut off for apply and replace --filename flag 2022-07-28 11:33:34 +08:00
rollout Fix rollout history bug 2022-07-13 18:27:05 -04:00
run Revert "Remove unused flags from kubectl run" 2022-09-05 09:34:48 -04:00
scale Set validate functions requiring no parameters for all commands 2022-05-17 11:38:20 +03:00
set style: remove redundant judgment 2022-07-29 18:25:05 +08:00
taint add server-side validation support to kubectl 2022-03-09 14:52:32 +00:00
testing Add auth API to get self subject attributes 2022-07-22 04:01:52 +04:00
top Refactor completion code into its own package 2022-03-24 09:06:05 -04:00
util Improve kubectl display of invalid errors 2022-08-31 11:49:34 -04:00
version Update kubectl kustomize to kyaml/v0.13.9, cmd/config/v0.10.9, api/v0.12.1, kustomize/v4.5.7 (#111606) 2022-08-03 04:48:50 +00:00
wait Fix flakiness with kubectl wait tests (#111168) 2022-07-28 20:44:55 +00:00
alpha.go Add auth API to get self subject attributes 2022-07-22 04:01:52 +04:00
cmd.go Add support for shell completion for plugins 2021-09-15 21:44:07 -04:00
cmd_test.go Switch from arguments to an input structure for kubectl command 2021-11-04 16:29:08 +01:00
profiling.go Add Close() for profile 2021-12-15 21:03:34 +08:00
skiplookerr_go118.go Adjust for os/exec changes in 1.19 2022-07-22 17:42:11 -04:00
skiplookerr_go119.go Adjust for os/exec changes in 1.19 2022-07-22 17:42:11 -04:00