-
-
Notifications
You must be signed in to change notification settings - Fork 234
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
incus/network: add dynamic command line completions #368
Conversation
This is far from a full set of dynamic completions, but this is a good start and handles all of the basic Marking as ready to review so I can get some feedback. |
Looking pretty good. Just the hardcoded As someone who runs with well over a dozen different remotes, a bunch of those being clusters with hundreds of instances and some of which requiring VPNs, I don't know that completing across all remotes is necessarily the right thing to do though :) It may make more sense to only complete over the current default remote and motivate folks to |
Signed-off-by: Adam Stephens <adam@valkor.net>
Thanks for the feedback. I was a bit worried about the performance impact of iterating all the remotes, but hadn't thought of a better way. Now that I understand how this all works a bit better though, you inspired me to a nicer solution. The changes I just pushed switch it so that if you haven't typed a remote (no colon in the entry), it'll suggest all the default resources plus all the available remote names. Once you have typed the colon (or tab completed it), and hit tab again, it will query the named remote for the resources. This should provide the benefit of not hitting endpoints until requested, but still allowing for tab completion for those remotes. |
With an example:
|
Oh neat, that's definitely the best of all worlds! |
Thanks, very cool work! |
The shell handles the filtering for you, but we could try and filter by remote name for example in class someone hits tab again.
I'll probably finish building out network to see if I can just reuse this function or the bulk of it, but this is a start.Done.Example
One can also explore these directly