|
2 | 2 |
|
3 | 3 | > :warning: **Notice** |
4 | 4 | > * This has been tested on for kubectl v1.23 and has not been tested on the kubectl v1.24. |
5 | | -> * Not all kubectl plugins have been tested. You can find a listed of tested plugins at [here](https://github.com/MartinSimango/kubectl-plugin_completion/blob/main/tested-plugins.txt). Please not if a plugin hasn't been tested |
| 5 | +> * Not all kubectl plugins have been tested. You can find a listed of tested plugins at [here](https://github.com/MartinSimango/kubectl-plugin_completion/blob/main/tested-plugins.txt). Please note if a plugin hasn't been tested |
6 | 6 | > it might cause unwanted errors such as your shell hanging. |
7 | 7 | > * Plugin only supports zsh and bash shells (for now). |
8 | 8 |
|
@@ -40,40 +40,40 @@ The config files contain information about the available kubectl plugins along w |
40 | 40 | shell: zsh |
41 | 41 | shellLocation: /bin/zsh |
42 | 42 | plugins: |
43 | | -- name: cert_manager |
| 43 | +- name: access_matrix |
44 | 44 | completionFunctionName: "" |
45 | | - description: A kubectl plugin called cert_manager |
| 45 | + description: 'Show an RBAC access matrix for server resources ' |
46 | 46 | supportsCobraCompletion: false |
47 | | -- name: krew |
48 | | - completionFunctionName: _krew |
49 | | - description: A kubectl plugin called krew |
| 47 | +- name: accurate |
| 48 | + completionFunctionName: _accurate |
| 49 | + description: 'Manage Accurate, a multi-tenancy controller ' |
50 | 50 | supportsCobraCompletion: true |
51 | | -- name: stern |
| 51 | +- name: allctx |
52 | 52 | completionFunctionName: "" |
53 | | - description: A kubectl plugin called stern |
54 | | - supportsCobraCompletion: false |
55 | | -- name: hello |
56 | | - completionFunctionName: "" |
57 | | - description: A kubectl plugin called hello |
| 53 | + description: 'Run commands on contexts in your kubeconfig ' |
58 | 54 | supportsCobraCompletion: false |
59 | 55 | - name: plugin_completion |
60 | 56 | completionFunctionName: _plugin_completion |
61 | | - description: A kubectl plugin called plugin_completion |
| 57 | + description: A kubectl plugin for allowing shell completions for kubectl plugins |
62 | 58 | supportsCobraCompletion: true |
| 59 | +kubectlOverridePlugins: |
| 60 | +- allctx |
63 | 61 | ``` |
64 | 62 |
|
65 | 63 | The above file can be generated by running: |
66 | 64 | ``` sh |
67 | 65 | $ kubectl plugin_completion config generate |
68 | 66 | ``` |
69 | | -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". |
| 67 | +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" if the plugin is not found in the krew repository. |
70 | 68 |
|
71 | 69 | 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: |
72 | 70 |
|
73 | 71 | ```sh |
74 | 72 | $ kubectl plugin_completion config edit zsh --plugin-name=plugin_name --completion-function="_completion_function_name" |
75 | 73 | ``` |
76 | 74 |
|
| 75 | +Plugins who's completion script override the default kubectl completion function such as the allctx plugin can be added to the kubectlOverridePlugins array. Thus typing `kubectl allctx <TAB><TAB>` will still give completions for the kubectl command. |
| 76 | + |
77 | 77 | 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. |
78 | 78 |
|
79 | 79 | ## How to use |
|
0 commit comments