You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The plugin works by reading config files for specfic shells (so far only bash and zsh). These config files in a folder located at `$HOME/.kube/plugin-completion-config` and are named `$SHELL_NAME.yaml`. So for example the zsh config file will be located at `$HOME/.kube/plugin-completion-config/zsh.yaml`.
29
29
30
-
The config files contain information about the available kubectl plugins along with some additional information such as plugin's description and the plugin's completion function name. Below is an example of what a config file for a zsh terminal will look like:
30
+
The config files contain information about the available kubectl plugins along with some additional information such as the plugin's description and the plugin's completion function name. Below is an example of what a config file for a zsh terminal will look like:
31
31
32
32
```yaml
33
33
shell: zsh
34
34
shellLocation: /bin/zsh
35
35
plugins:
36
+
- name: cert_manager
37
+
completionFunctionName: ""
38
+
description: A kubectl plugin called cert_manager
39
+
supportsCobraCompletion: false
36
40
- name: krew
37
41
completionFunctionName: _krew
38
42
description: A kubectl plugin called krew
43
+
supportsCobraCompletion: true
44
+
- name: stern
45
+
completionFunctionName: ""
46
+
description: A kubectl plugin called stern
47
+
supportsCobraCompletion: false
39
48
- name: hello
40
49
completionFunctionName: ""
41
50
description: A kubectl plugin called hello
51
+
supportsCobraCompletion: false
42
52
- name: plugin_completion
43
53
completionFunctionName: _plugin_completion
44
54
description: A kubectl plugin called plugin_completion
55
+
supportsCobraCompletion: true
45
56
```
46
57
47
58
The above file can be generated by running:
48
59
```sh
49
60
$ kubectl plugin_completion config generate
50
61
```
51
-
This will generate config files for all supported shells (zsh and bash). For plugins that were created using [cobra](https://github.com/spf13/cobra) the `completionFunctionName` field will automatically be field in. The description for each plugin will default to: "A kubectl plugin called $plugin_name".
62
+
This will generate config files for all supported shells (zsh and bash). For plugins that were created using [cobra](https://github.com/spf13/cobra)and have that have a cobra completion command the `completionFunctionName` field will automatically be field in. The description for each plugin will default to: "A kubectl plugin called $plugin_name".
52
63
53
-
If a plugin was not created by using [cobra](https://github.com/spf13/cobra) it will be up to you to manually edit the config file and provide the name of the plugin's completion function name. This can also be done by running the `kubectl plugin_completion config edit` command as shown below:
64
+
If a plugin was not created by using [cobra](https://github.com/spf13/cobra)or if the plugin was created using cobra but does not have a completion subcommand, it will be up to you to manually edit the config file and provide the name of the plugin's completion function name. This can also be done by running the `kubectl plugin_completion config edit` command as shown below:
The plugin_completion uses config files to generate completions specific shells in order to allow for completions for kubectl plugins. The generated completion scripts overwrite the behaviour of the completion function for the kubectl tool and extend it to allow for kubectl plugin completions.
0 commit comments