[kubectl] kubectl resource auto complete should use caching
Sanity checks
- [X] My issue relates to a specific CLI completion spec (e.g.
git checkoutis missing options ingitcompletion spec). If your issue is more general, please create your issue here: withfig/fig - [X] I have searched github.com/withfig/autocomplete/issues and there are no duplicates of my issue
- [ ] I would like to work on this.
What CLI tool does this relate to?
kubectl
Which statement makes the most sense?
Something else
Issue Details
when trying preform an action on a kubernetes resource, fig.io reads all the existing resources with this resource type for example
kubectl scale deployment ...
but when deleting a word or just trying to type the command again it will try to fetch all the data again, even though it just fetched it a couple of seconds ago
i believe for that the kubectl plugin (any maybe other plugins, but thats outside the scope of this issue) will benefit to cache / store the results of the previous autocomplete suggestions (for every type of autocomplete which requires running a command against kubernetes and awaiting its response)
it can perform the fetch request to kubernetes in the background and update the cache asynchronously, the cache can also have a maximum TTL if we want to make sure to refresh the resuls after some time (can also be configurable in the settings menu)