kubectl/pkg/cmd
Kazuki Suda 9c405e27d0 Add completion support for kubectl plugins
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
2019-04-14 14:40:53 +09: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 completion support for kubectl plugins 2019-04-14 14:40:53 +09: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 completion support for kubectl plugins 2019-04-14 14:40:53 +09: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 Generate and format files 2022-07-19 20:54:13 -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