Skip to content

Commit 672ffcc

Browse files
Update README.md
1 parent d9ff536 commit 672ffcc

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,33 +27,44 @@ $ kubectl krew install --manifest-url https://github.com/MartinSimango/kubectl-p
2727

2828
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`.
2929

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:
3131

3232
```yaml
3333
shell: zsh
3434
shellLocation: /bin/zsh
3535
plugins:
36+
- name: cert_manager
37+
completionFunctionName: ""
38+
description: A kubectl plugin called cert_manager
39+
supportsCobraCompletion: false
3640
- name: krew
3741
completionFunctionName: _krew
3842
description: A kubectl plugin called krew
43+
supportsCobraCompletion: true
44+
- name: stern
45+
completionFunctionName: ""
46+
description: A kubectl plugin called stern
47+
supportsCobraCompletion: false
3948
- name: hello
4049
completionFunctionName: ""
4150
description: A kubectl plugin called hello
51+
supportsCobraCompletion: false
4252
- name: plugin_completion
4353
completionFunctionName: _plugin_completion
4454
description: A kubectl plugin called plugin_completion
55+
supportsCobraCompletion: true
4556
```
4657
4758
The above file can be generated by running:
4859
``` sh
4960
$ kubectl plugin_completion config generate
5061
```
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".
5263

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:
5465

5566
```sh
56-
$ kubectl plugin_completion config edit zsh --plugin-name=custom_plugin --completion-function="_completion_function_name"
67+
$ kubectl plugin_completion config edit zsh --plugin-name=plugin_name --completion-function="_completion_function_name"
5768
```
5869

5970
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

Comments
 (0)