Implement tab completions for resource names
kingdevnl opened this issue · 6 comments
Thanks already so far for this!,
It would be amazing if all the tab completions would work in the future like for bash using: https://kubernetes.io/docs/tasks/tools/install-kubectl/#introduction
will donate 10 usd for the feature
@mziyabo I decided to take a crack at this one. Note: Powershell is not exactly my strong suit, so apologies in advance if the code is bad :)
@TravisTX How could i install the version of your PR?
- Uninstall the current module
Uninstall-Module -Name PSKubectlCompletion
- Restart your terminal, confirm the module is no longer working
- Download the psm1 file from my PR
- Replace your
Import-Module
withImport-Module "C:\...\PSKubectlCompletion.psm1"
(wherever you downloaded the file to)
@TravisTX Just did that
I'm not getting any resource name autocompletion eg: kubectl logs pod test
I confirmed that it's using your fork PR's files (I added a echo command to check)
@TravisTX Thank you it looks good so far. Just need to check the following I think and then we're good:
- order or sort the resource names to be auto-suggested before the flags or other options. Is this possible? I.e. prepend to the $flags variable or similar.
- It seems that just tabbing won't autocomplete e.g. if I tab on 'kubectl get pods ' nothing comes up. But if I then enter the first letter etc and ask for completion it works. This is a bit different from original behaviour. It also shows up if for example you Ctrl-Space for auto-completion.
- Lastly If you issued something like this 'kubectl.exe get pods --namespace web ' we then do not autosuggest items in the web namespace, instead we will force getting pods in the namespace specified in out context- Just check this for me and verify. I think this would trip some people up
I think the 1 and 2 above might explain @kingdevnl's issue as well?