-
Notifications
You must be signed in to change notification settings - Fork 763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support command completions from installed tools #752
Comments
Hello, I just stumbled upon this issue as I'm having the same problem. Running Ideally A note: Do you think this would be possible? I'm willing to submit a PR but I'd like to discuss how to implement this first. (BTW thank you for the awesome project 💪) |
Here is a quick hack that I came up with:
This registers I did not know how to integrate this into
With the limited time I spent on this, I was not able to figure out how to call the original completion, but in this particular case calling I am curious if this could be generalized for other asdf plugins (e.g., |
FWIW, a general version of this is not so hard (requires Bash 4.3 for the variable references):
Note that This obviously also works for static completions, e.g.,
It seems though that static completions might not be at the same path for different versions of a plugin or even missing for earlier versions. |
Adding to this, manually sourcing completion files in your Lazily loading completions for kubectl-style tools helps slightly, but even In the case of kubectl for example, you could have an optional Thoughts? |
I would love to contribute on this feature. If no one working on this. |
@kamontat Go ahead! This is a very useful feature |
@hyperupcall Do we have design review yet? Sorry for late reply. I didn't saw your message. |
@kamontat There is no design review besides just the comments in this issue. I also have some extra notes below. When implementing, I think it is important to consider:
For [1], it might be worth looking into supporting a new file for plugins to have: For [2], I'd say it's okay for an initial implementation to only support one shell (perhaps Bash). More shells can be supported in future PRs. [3] isn't as important, because that logic should be placed in each I wrote [4] and [5] for similar reasons. This feature will absolutely kill performance, once implemented. So, an initial implementation will either be opt-in, to allow for incremental improvements without disrupting existing workflows, and/or cache like crazy so things don't slow down even more. |
Describe the solution you'd like
I recently discovered asdf, and installed it hoping I could manage all my various hand-installed binaries (especially everything I use for Kubernetes). Most of the Kubernetes tools are much less useful without completions, as you often have to look up a pod name and then secondly perform some action on them, in two separate commands. With command completions, I can simply autocomplete the pod names, which saves me running an entire command.
A lot of kubernetes tools, such as
kubectl
andhelm
all include completions directly in the binary, but they have to be loaded like this (in zsh):I'm aware that many plugins provide completions in different ways, but pretty much all Kubernetes tools provide them like this.
Would it be possible for asdf to somehow enable the loading of completions from each plugin, such that a plugin author can include some configuration that tells asdf how to load completions.
Describe similar asdf features and why they are not sufficient
asdf already supplies completions for itself, but that doesn't help me look up pods via kubectl.
Describe workarounds you've considered
The simplest workaround would be to simply add all the completions in my .zshrc, like I've always done, but it would be nice if asdf automatically installed and set up the completions.
The text was updated successfully, but these errors were encountered: