Open unixorn opened 5 months ago
@unixorn I took reference from the kubectl plugin. https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/kubectl/kubectl.plugin.zsh
Is that really so bad?
No, I was just curious. I get wanting to ensure you're running the version of the completion that matches the version of talosctl
.
You could optimize it to either do it once per day by checking the creation time of the completion's creation time, or even better, compare it to the completion time of talosctl
and only regenerate it when talosctl
gets updated.
I noticed it when I was adding the completion to the awesome-zsh-plugins list in https://github.com/unixorn/awesome-zsh-plugins/pull/1840
The only real complication I can think of with your approach (which is the most common one) would be if one shell session was loading the completion file while another was regenerating it and the odds of that are super low.
You have the
outside the
stanza. Do you want to recreate the file every time the plugin loads?